aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2011-04-04 17:59:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-04 20:51:46 -0400
commit5aba085ededa6c5a1ff465e2aebc3e8eb00a7567 (patch)
tree61037c7906bc6334823bc75d1fa0b990aeadcea3
parent21b86bd5a838ee882d36d354185e29650b0757dd (diff)
kernel/signal.c: fix typos and coding style
General coding style and comment fixes; no code changes: - Use multi-line-comment coding style. - Put some function signatures completely on one line. - Hyphenate some words. - Spell Posix as POSIX. - Correct typos & spellos in some comments. - Drop trailing whitespace. - End sentences with periods. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/signal.c90
1 files changed, 48 insertions, 42 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 1186cf7fac77..3ab90e8b6ecf 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -226,7 +226,7 @@ static inline void print_dropped_signal(int sig)
226/* 226/*
227 * allocate a new signal queue record 227 * allocate a new signal queue record
228 * - this may be called without locks if and only if t == current, otherwise an 228 * - this may be called without locks if and only if t == current, otherwise an
229 * appopriate lock must be held to stop the target task from exiting 229 * appropriate lock must be held to stop the target task from exiting
230 */ 230 */
231static struct sigqueue * 231static struct sigqueue *
232__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit) 232__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
@@ -375,15 +375,15 @@ int unhandled_signal(struct task_struct *tsk, int sig)
375 return !tracehook_consider_fatal_signal(tsk, sig); 375 return !tracehook_consider_fatal_signal(tsk, sig);
376} 376}
377 377
378 378/*
379/* Notify the system that a driver wants to block all signals for this 379 * Notify the system that a driver wants to block all signals for this
380 * process, and wants to be notified if any signals at all were to be 380 * process, and wants to be notified if any signals at all were to be
381 * sent/acted upon. If the notifier routine returns non-zero, then the 381 * sent/acted upon. If the notifier routine returns non-zero, then the
382 * signal will be acted upon after all. If the notifier routine returns 0, 382 * signal will be acted upon after all. If the notifier routine returns 0,
383 * then then signal will be blocked. Only one block per process is 383 * then then signal will be blocked. Only one block per process is
384 * allowed. priv is a pointer to private data that the notifier routine 384 * allowed. priv is a pointer to private data that the notifier routine
385 * can use to determine if the signal should be blocked or not. */ 385 * can use to determine if the signal should be blocked or not.
386 386 */
387void 387void
388block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask) 388block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
389{ 389{
@@ -434,9 +434,10 @@ still_pending:
434 copy_siginfo(info, &first->info); 434 copy_siginfo(info, &first->info);
435 __sigqueue_free(first); 435 __sigqueue_free(first);
436 } else { 436 } else {
437 /* Ok, it wasn't in the queue. This must be 437 /*
438 a fast-pathed signal or we must have been 438 * Ok, it wasn't in the queue. This must be
439 out of queue space. So zero out the info. 439 * a fast-pathed signal or we must have been
440 * out of queue space. So zero out the info.
440 */ 441 */
441 info->si_signo = sig; 442 info->si_signo = sig;
442 info->si_errno = 0; 443 info->si_errno = 0;
@@ -468,7 +469,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
468} 469}
469 470
470/* 471/*
471 * Dequeue a signal and return the element to the caller, which is 472 * Dequeue a signal and return the element to the caller, which is
472 * expected to free it. 473 * expected to free it.
473 * 474 *
474 * All callers have to hold the siglock. 475 * All callers have to hold the siglock.
@@ -490,7 +491,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
490 * itimers are process shared and we restart periodic 491 * itimers are process shared and we restart periodic
491 * itimers in the signal delivery path to prevent DoS 492 * itimers in the signal delivery path to prevent DoS
492 * attacks in the high resolution timer case. This is 493 * attacks in the high resolution timer case. This is
493 * compliant with the old way of self restarting 494 * compliant with the old way of self-restarting
494 * itimers, as the SIGALRM is a legacy signal and only 495 * itimers, as the SIGALRM is a legacy signal and only
495 * queued once. Changing the restart behaviour to 496 * queued once. Changing the restart behaviour to
496 * restart the timer in the signal dequeue path is 497 * restart the timer in the signal dequeue path is
@@ -923,14 +924,15 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
923 if (info == SEND_SIG_FORCED) 924 if (info == SEND_SIG_FORCED)
924 goto out_set; 925 goto out_set;
925 926
926 /* Real-time signals must be queued if sent by sigqueue, or 927 /*
927 some other real-time mechanism. It is implementation 928 * Real-time signals must be queued if sent by sigqueue, or
928 defined whether kill() does so. We attempt to do so, on 929 * some other real-time mechanism. It is implementation
929 the principle of least surprise, but since kill is not 930 * defined whether kill() does so. We attempt to do so, on
930 allowed to fail with EAGAIN when low on memory we just 931 * the principle of least surprise, but since kill is not
931 make sure at least one signal gets delivered and don't 932 * allowed to fail with EAGAIN when low on memory we just
932 pass on the info struct. */ 933 * make sure at least one signal gets delivered and don't
933 934 * pass on the info struct.
935 */
934 if (sig < SIGRTMIN) 936 if (sig < SIGRTMIN)
935 override_rlimit = (is_si_special(info) || info->si_code >= 0); 937 override_rlimit = (is_si_special(info) || info->si_code >= 0);
936 else 938 else
@@ -1201,8 +1203,7 @@ retry:
1201 return error; 1203 return error;
1202} 1204}
1203 1205
1204int 1206int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1205kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1206{ 1207{
1207 int error; 1208 int error;
1208 rcu_read_lock(); 1209 rcu_read_lock();
@@ -1299,8 +1300,7 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
1299 * These are for backward compatibility with the rest of the kernel source. 1300 * These are for backward compatibility with the rest of the kernel source.
1300 */ 1301 */
1301 1302
1302int 1303int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1303send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1304{ 1304{
1305 /* 1305 /*
1306 * Make sure legacy kernel users don't send in bad values 1306 * Make sure legacy kernel users don't send in bad values
@@ -1368,7 +1368,7 @@ EXPORT_SYMBOL(kill_pid);
1368 * These functions support sending signals using preallocated sigqueue 1368 * These functions support sending signals using preallocated sigqueue
1369 * structures. This is needed "because realtime applications cannot 1369 * structures. This is needed "because realtime applications cannot
1370 * afford to lose notifications of asynchronous events, like timer 1370 * afford to lose notifications of asynchronous events, like timer
1371 * expirations or I/O completions". In the case of Posix Timers 1371 * expirations or I/O completions". In the case of POSIX Timers
1372 * we allocate the sigqueue structure from the timer_create. If this 1372 * we allocate the sigqueue structure from the timer_create. If this
1373 * allocation fails we are able to report the failure to the application 1373 * allocation fails we are able to report the failure to the application
1374 * with an EAGAIN error. 1374 * with an EAGAIN error.
@@ -1553,7 +1553,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
1553 info.si_signo = SIGCHLD; 1553 info.si_signo = SIGCHLD;
1554 info.si_errno = 0; 1554 info.si_errno = 0;
1555 /* 1555 /*
1556 * see comment in do_notify_parent() abot the following 3 lines 1556 * see comment in do_notify_parent() about the following 4 lines
1557 */ 1557 */
1558 rcu_read_lock(); 1558 rcu_read_lock();
1559 info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns); 1559 info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
@@ -1611,7 +1611,7 @@ static inline int may_ptrace_stop(void)
1611} 1611}
1612 1612
1613/* 1613/*
1614 * Return nonzero if there is a SIGKILL that should be waking us up. 1614 * Return non-zero if there is a SIGKILL that should be waking us up.
1615 * Called with the siglock held. 1615 * Called with the siglock held.
1616 */ 1616 */
1617static int sigkill_pending(struct task_struct *tsk) 1617static int sigkill_pending(struct task_struct *tsk)
@@ -1735,7 +1735,7 @@ void ptrace_notify(int exit_code)
1735/* 1735/*
1736 * This performs the stopping for SIGSTOP and other stop signals. 1736 * This performs the stopping for SIGSTOP and other stop signals.
1737 * We have to stop all threads in the thread group. 1737 * We have to stop all threads in the thread group.
1738 * Returns nonzero if we've actually stopped and released the siglock. 1738 * Returns non-zero if we've actually stopped and released the siglock.
1739 * Returns zero if we didn't stop and still hold the siglock. 1739 * Returns zero if we didn't stop and still hold the siglock.
1740 */ 1740 */
1741static int do_signal_stop(int signr) 1741static int do_signal_stop(int signr)
@@ -1823,10 +1823,12 @@ static int ptrace_signal(int signr, siginfo_t *info,
1823 1823
1824 current->exit_code = 0; 1824 current->exit_code = 0;
1825 1825
1826 /* Update the siginfo structure if the signal has 1826 /*
1827 changed. If the debugger wanted something 1827 * Update the siginfo structure if the signal has
1828 specific in the siginfo structure then it should 1828 * changed. If the debugger wanted something
1829 have updated *info via PTRACE_SETSIGINFO. */ 1829 * specific in the siginfo structure then it should
1830 * have updated *info via PTRACE_SETSIGINFO.
1831 */
1830 if (signr != info->si_signo) { 1832 if (signr != info->si_signo) {
1831 info->si_signo = signr; 1833 info->si_signo = signr;
1832 info->si_errno = 0; 1834 info->si_errno = 0;
@@ -2034,7 +2036,8 @@ void exit_signals(struct task_struct *tsk)
2034 if (!signal_pending(tsk)) 2036 if (!signal_pending(tsk))
2035 goto out; 2037 goto out;
2036 2038
2037 /* It could be that __group_complete_signal() choose us to 2039 /*
2040 * It could be that __group_complete_signal() choose us to
2038 * notify about group-wide signal. Another thread should be 2041 * notify about group-wide signal. Another thread should be
2039 * woken now to take the signal since we will not. 2042 * woken now to take the signal since we will not.
2040 */ 2043 */
@@ -2183,7 +2186,7 @@ long do_sigpending(void __user *set, unsigned long sigsetsize)
2183 2186
2184out: 2187out:
2185 return error; 2188 return error;
2186} 2189}
2187 2190
2188SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize) 2191SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
2189{ 2192{
@@ -2233,9 +2236,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2233 err |= __put_user(from->si_trapno, &to->si_trapno); 2236 err |= __put_user(from->si_trapno, &to->si_trapno);
2234#endif 2237#endif
2235#ifdef BUS_MCEERR_AO 2238#ifdef BUS_MCEERR_AO
2236 /* 2239 /*
2237 * Other callers might not initialize the si_lsb field, 2240 * Other callers might not initialize the si_lsb field,
2238 * so check explicitely for the right codes here. 2241 * so check explicitly for the right codes here.
2239 */ 2242 */
2240 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 2243 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
2241 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 2244 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
@@ -2280,7 +2283,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2280 2283
2281 if (copy_from_user(&these, uthese, sizeof(these))) 2284 if (copy_from_user(&these, uthese, sizeof(these)))
2282 return -EFAULT; 2285 return -EFAULT;
2283 2286
2284 /* 2287 /*
2285 * Invert the set of allowed signals to get those we 2288 * Invert the set of allowed signals to get those we
2286 * want to block. 2289 * want to block.
@@ -2305,9 +2308,11 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2305 + (ts.tv_sec || ts.tv_nsec)); 2308 + (ts.tv_sec || ts.tv_nsec));
2306 2309
2307 if (timeout) { 2310 if (timeout) {
2308 /* None ready -- temporarily unblock those we're 2311 /*
2312 * None ready -- temporarily unblock those we're
2309 * interested while we are sleeping in so that we'll 2313 * interested while we are sleeping in so that we'll
2310 * be awakened when they arrive. */ 2314 * be awakened when they arrive.
2315 */
2311 current->real_blocked = current->blocked; 2316 current->real_blocked = current->blocked;
2312 sigandsets(&current->blocked, &current->blocked, &these); 2317 sigandsets(&current->blocked, &current->blocked, &these);
2313 recalc_sigpending(); 2318 recalc_sigpending();
@@ -2553,12 +2558,11 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
2553 2558
2554 error = -EINVAL; 2559 error = -EINVAL;
2555 /* 2560 /*
2556 * 2561 * Note - this code used to test ss_flags incorrectly:
2557 * Note - this code used to test ss_flags incorrectly
2558 * old code may have been written using ss_flags==0 2562 * old code may have been written using ss_flags==0
2559 * to mean ss_flags==SS_ONSTACK (as this was the only 2563 * to mean ss_flags==SS_ONSTACK (as this was the only
2560 * way that worked) - this fix preserves that older 2564 * way that worked) - this fix preserves that older
2561 * mechanism 2565 * mechanism.
2562 */ 2566 */
2563 if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0) 2567 if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
2564 goto out; 2568 goto out;
@@ -2600,8 +2604,10 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2600#endif 2604#endif
2601 2605
2602#ifdef __ARCH_WANT_SYS_SIGPROCMASK 2606#ifdef __ARCH_WANT_SYS_SIGPROCMASK
2603/* Some platforms have their own version with special arguments others 2607/*
2604 support only sys_rt_sigprocmask. */ 2608 * Some platforms have their own version with special arguments;
2609 * others support only sys_rt_sigprocmask.
2610 */
2605 2611
2606SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set, 2612SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
2607 old_sigset_t __user *, oset) 2613 old_sigset_t __user *, oset)