diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-02-05 01:31:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:30 -0500 |
commit | cfef8f34e7cf57f3d278ceda79c85112dec13dc6 (patch) | |
tree | 5ddaf58aa91905cfda2917d6264e24fb950ab88f /arch/um/os-Linux/signal.c | |
parent | d7b88513c504e49d450b0f89f80ba9d451a3c804 (diff) |
uml: signal handling tidying
This patch tidies the signal handling code slightly.
pending is renamed to signals_pending for symmetry with signals_enabled.
remove_sigstack was unused, so can be deleted.
The value of change_sig was never used, so it is now void and the
return value is not calculated any more.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux/signal.c')
-rw-r--r-- | arch/um/os-Linux/signal.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 91a35da5fe90..0fb0cc8d4757 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -63,7 +63,7 @@ static void sig_handler_common(int sig, struct sigcontext *sc) | |||
63 | #define SIGVTALRM_MASK (1 << SIGVTALRM_BIT) | 63 | #define SIGVTALRM_MASK (1 << SIGVTALRM_BIT) |
64 | 64 | ||
65 | static int signals_enabled; | 65 | static int signals_enabled; |
66 | static unsigned int pending; | 66 | static unsigned int signals_pending; |
67 | 67 | ||
68 | void sig_handler(int sig, struct sigcontext *sc) | 68 | void sig_handler(int sig, struct sigcontext *sc) |
69 | { | 69 | { |
@@ -71,7 +71,7 @@ void sig_handler(int sig, struct sigcontext *sc) | |||
71 | 71 | ||
72 | enabled = signals_enabled; | 72 | enabled = signals_enabled; |
73 | if (!enabled && (sig == SIGIO)) { | 73 | if (!enabled && (sig == SIGIO)) { |
74 | pending |= SIGIO_MASK; | 74 | signals_pending |= SIGIO_MASK; |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
@@ -99,7 +99,7 @@ void alarm_handler(int sig, struct sigcontext *sc) | |||
99 | 99 | ||
100 | enabled = signals_enabled; | 100 | enabled = signals_enabled; |
101 | if (!signals_enabled) { | 101 | if (!signals_enabled) { |
102 | pending |= SIGVTALRM_MASK; | 102 | signals_pending |= SIGVTALRM_MASK; |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | 105 | ||
@@ -125,16 +125,6 @@ void set_sigstack(void *sig_stack, int size) | |||
125 | panic("enabling signal stack failed, errno = %d\n", errno); | 125 | panic("enabling signal stack failed, errno = %d\n", errno); |
126 | } | 126 | } |
127 | 127 | ||
128 | void remove_sigstack(void) | ||
129 | { | ||
130 | stack_t stack = ((stack_t) { .ss_flags = SS_DISABLE, | ||
131 | .ss_sp = NULL, | ||
132 | .ss_size = 0 }); | ||
133 | |||
134 | if (sigaltstack(&stack, NULL) != 0) | ||
135 | panic("disabling signal stack failed, errno = %d\n", errno); | ||
136 | } | ||
137 | |||
138 | void (*handlers[_NSIG])(int sig, struct sigcontext *sc); | 128 | void (*handlers[_NSIG])(int sig, struct sigcontext *sc); |
139 | 129 | ||
140 | void handle_signal(int sig, struct sigcontext *sc) | 130 | void handle_signal(int sig, struct sigcontext *sc) |
@@ -213,13 +203,14 @@ void set_handler(int sig, void (*handler)(int), int flags, ...) | |||
213 | 203 | ||
214 | int change_sig(int signal, int on) | 204 | int change_sig(int signal, int on) |
215 | { | 205 | { |
216 | sigset_t sigset, old; | 206 | sigset_t sigset; |
217 | 207 | ||
218 | sigemptyset(&sigset); | 208 | sigemptyset(&sigset); |
219 | sigaddset(&sigset, signal); | 209 | sigaddset(&sigset, signal); |
220 | if (sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old) < 0) | 210 | if (sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, NULL) < 0) |
221 | return -errno; | 211 | return -errno; |
222 | return !sigismember(&old, signal); | 212 | |
213 | return 0; | ||
223 | } | 214 | } |
224 | 215 | ||
225 | void block_signals(void) | 216 | void block_signals(void) |
@@ -244,26 +235,26 @@ void unblock_signals(void) | |||
244 | /* | 235 | /* |
245 | * We loop because the IRQ handler returns with interrupts off. So, | 236 | * We loop because the IRQ handler returns with interrupts off. So, |
246 | * interrupts may have arrived and we need to re-enable them and | 237 | * interrupts may have arrived and we need to re-enable them and |
247 | * recheck pending. | 238 | * recheck signals_pending. |
248 | */ | 239 | */ |
249 | while(1) { | 240 | while(1) { |
250 | /* | 241 | /* |
251 | * Save and reset save_pending after enabling signals. This | 242 | * Save and reset save_pending after enabling signals. This |
252 | * way, pending won't be changed while we're reading it. | 243 | * way, signals_pending won't be changed while we're reading it. |
253 | */ | 244 | */ |
254 | signals_enabled = 1; | 245 | signals_enabled = 1; |
255 | 246 | ||
256 | /* | 247 | /* |
257 | * Setting signals_enabled and reading pending must | 248 | * Setting signals_enabled and reading signals_pending must |
258 | * happen in this order. | 249 | * happen in this order. |
259 | */ | 250 | */ |
260 | barrier(); | 251 | barrier(); |
261 | 252 | ||
262 | save_pending = pending; | 253 | save_pending = signals_pending; |
263 | if (save_pending == 0) | 254 | if (save_pending == 0) |
264 | return; | 255 | return; |
265 | 256 | ||
266 | pending = 0; | 257 | signals_pending = 0; |
267 | 258 | ||
268 | /* | 259 | /* |
269 | * We have pending interrupts, so disable signals, as the | 260 | * We have pending interrupts, so disable signals, as the |