diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-01-18 20:43:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:29 -0500 |
commit | 150256d8aadb3a337c31efa9e175cbd25bf06b06 (patch) | |
tree | 8cd7e2a0bc6af23984682c5ea3ca687809580c5a /arch/powerpc/kernel | |
parent | a60fc5190a31d98508ea6a76f74217f4104e74b7 (diff) |
[PATCH] Generic sys_rt_sigsuspend()
The TIF_RESTORE_SIGMASK flag allows us to have a generic implementation of
sys_rt_sigsuspend() instead of duplicating it for each architecture. This
provides such an implementation and makes arch/powerpc use it.
It also tidies up the ppc32 sys_sigsuspend() to use TIF_RESTORE_SIGMASK.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/signal_32.c | 56 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal_64.c | 36 |
2 files changed, 5 insertions, 87 deletions
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 177bba78fb0b..7f0d5ce2567d 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -252,8 +252,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs); | |||
252 | /* | 252 | /* |
253 | * Atomically swap in the new signal mask, and wait for a signal. | 253 | * Atomically swap in the new signal mask, and wait for a signal. |
254 | */ | 254 | */ |
255 | long sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7, | 255 | long sys_sigsuspend(old_sigset_t mask) |
256 | struct pt_regs *regs) | ||
257 | { | 256 | { |
258 | sigset_t saveset; | 257 | sigset_t saveset; |
259 | 258 | ||
@@ -264,55 +263,10 @@ long sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7, | |||
264 | recalc_sigpending(); | 263 | recalc_sigpending(); |
265 | spin_unlock_irq(¤t->sighand->siglock); | 264 | spin_unlock_irq(¤t->sighand->siglock); |
266 | 265 | ||
267 | regs->result = -EINTR; | 266 | current->state = TASK_INTERRUPTIBLE; |
268 | regs->gpr[3] = EINTR; | 267 | schedule(); |
269 | regs->ccr |= 0x10000000; | 268 | set_thread_flag(TIF_RESTORE_SIGMASK); |
270 | while (1) { | 269 | return -ERESTARTNOHAND; |
271 | current->state = TASK_INTERRUPTIBLE; | ||
272 | schedule(); | ||
273 | if (do_signal(&saveset, regs)) { | ||
274 | set_thread_flag(TIF_RESTOREALL); | ||
275 | return 0; | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | |||
280 | long sys_rt_sigsuspend( | ||
281 | #ifdef CONFIG_PPC64 | ||
282 | compat_sigset_t __user *unewset, | ||
283 | #else | ||
284 | sigset_t __user *unewset, | ||
285 | #endif | ||
286 | size_t sigsetsize, int p3, int p4, | ||
287 | int p6, int p7, struct pt_regs *regs) | ||
288 | { | ||
289 | sigset_t saveset, newset; | ||
290 | |||
291 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
292 | if (sigsetsize != sizeof(sigset_t)) | ||
293 | return -EINVAL; | ||
294 | |||
295 | if (get_sigset_t(&newset, unewset)) | ||
296 | return -EFAULT; | ||
297 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
298 | |||
299 | spin_lock_irq(¤t->sighand->siglock); | ||
300 | saveset = current->blocked; | ||
301 | current->blocked = newset; | ||
302 | recalc_sigpending(); | ||
303 | spin_unlock_irq(¤t->sighand->siglock); | ||
304 | |||
305 | regs->result = -EINTR; | ||
306 | regs->gpr[3] = EINTR; | ||
307 | regs->ccr |= 0x10000000; | ||
308 | while (1) { | ||
309 | current->state = TASK_INTERRUPTIBLE; | ||
310 | schedule(); | ||
311 | if (do_signal(&saveset, regs)) { | ||
312 | set_thread_flag(TIF_RESTOREALL); | ||
313 | return 0; | ||
314 | } | ||
315 | } | ||
316 | } | 270 | } |
317 | 271 | ||
318 | #ifdef CONFIG_PPC32 | 272 | #ifdef CONFIG_PPC32 |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 7b9d999e2115..a4a6812e815e 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -67,42 +67,6 @@ struct rt_sigframe { | |||
67 | char abigap[288]; | 67 | char abigap[288]; |
68 | } __attribute__ ((aligned (16))); | 68 | } __attribute__ ((aligned (16))); |
69 | 69 | ||
70 | |||
71 | /* | ||
72 | * Atomically swap in the new signal mask, and wait for a signal. | ||
73 | */ | ||
74 | long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, int p3, int p4, | ||
75 | int p6, int p7, struct pt_regs *regs) | ||
76 | { | ||
77 | sigset_t saveset, newset; | ||
78 | |||
79 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
80 | if (sigsetsize != sizeof(sigset_t)) | ||
81 | return -EINVAL; | ||
82 | |||
83 | if (copy_from_user(&newset, unewset, sizeof(newset))) | ||
84 | return -EFAULT; | ||
85 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
86 | |||
87 | spin_lock_irq(¤t->sighand->siglock); | ||
88 | saveset = current->blocked; | ||
89 | current->blocked = newset; | ||
90 | recalc_sigpending(); | ||
91 | spin_unlock_irq(¤t->sighand->siglock); | ||
92 | |||
93 | regs->result = -EINTR; | ||
94 | regs->gpr[3] = EINTR; | ||
95 | regs->ccr |= 0x10000000; | ||
96 | while (1) { | ||
97 | current->state = TASK_INTERRUPTIBLE; | ||
98 | schedule(); | ||
99 | if (do_signal(&saveset, regs)) { | ||
100 | set_thread_flag(TIF_RESTOREALL); | ||
101 | return 0; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | |||
106 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5, | 70 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5, |
107 | unsigned long r6, unsigned long r7, unsigned long r8, | 71 | unsigned long r6, unsigned long r7, unsigned long r8, |
108 | struct pt_regs *regs) | 72 | struct pt_regs *regs) |