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>
This commit is contained in:
committed by
Linus Torvalds
parent
21b86bd5a8
commit
5aba085ede
@@ -226,7 +226,7 @@ static inline void print_dropped_signal(int sig)
|
|||||||
/*
|
/*
|
||||||
* allocate a new signal queue record
|
* allocate a new signal queue record
|
||||||
* - this may be called without locks if and only if t == current, otherwise an
|
* - this may be called without locks if and only if t == current, otherwise an
|
||||||
* appopriate lock must be held to stop the target task from exiting
|
* appropriate lock must be held to stop the target task from exiting
|
||||||
*/
|
*/
|
||||||
static struct sigqueue *
|
static struct sigqueue *
|
||||||
__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
|
__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)
|
|||||||
return !tracehook_consider_fatal_signal(tsk, sig);
|
return !tracehook_consider_fatal_signal(tsk, sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* Notify the system that a driver wants to block all signals for this
|
* Notify the system that a driver wants to block all signals for this
|
||||||
* process, and wants to be notified if any signals at all were to be
|
* process, and wants to be notified if any signals at all were to be
|
||||||
* sent/acted upon. If the notifier routine returns non-zero, then the
|
* sent/acted upon. If the notifier routine returns non-zero, then the
|
||||||
* signal will be acted upon after all. If the notifier routine returns 0,
|
* signal will be acted upon after all. If the notifier routine returns 0,
|
||||||
* then then signal will be blocked. Only one block per process is
|
* then then signal will be blocked. Only one block per process is
|
||||||
* allowed. priv is a pointer to private data that the notifier routine
|
* allowed. priv is a pointer to private data that the notifier routine
|
||||||
* can use to determine if the signal should be blocked or not. */
|
* can use to determine if the signal should be blocked or not.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
|
block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
|
||||||
{
|
{
|
||||||
@@ -434,9 +434,10 @@ still_pending:
|
|||||||
copy_siginfo(info, &first->info);
|
copy_siginfo(info, &first->info);
|
||||||
__sigqueue_free(first);
|
__sigqueue_free(first);
|
||||||
} else {
|
} else {
|
||||||
/* Ok, it wasn't in the queue. This must be
|
/*
|
||||||
a fast-pathed signal or we must have been
|
* Ok, it wasn't in the queue. This must be
|
||||||
out of queue space. So zero out the info.
|
* a fast-pathed signal or we must have been
|
||||||
|
* out of queue space. So zero out the info.
|
||||||
*/
|
*/
|
||||||
info->si_signo = sig;
|
info->si_signo = sig;
|
||||||
info->si_errno = 0;
|
info->si_errno = 0;
|
||||||
@@ -468,7 +469,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dequeue a signal and return the element to the caller, which is
|
* Dequeue a signal and return the element to the caller, which is
|
||||||
* expected to free it.
|
* expected to free it.
|
||||||
*
|
*
|
||||||
* All callers have to hold the siglock.
|
* All callers have to hold the siglock.
|
||||||
@@ -490,7 +491,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
|
|||||||
* itimers are process shared and we restart periodic
|
* itimers are process shared and we restart periodic
|
||||||
* itimers in the signal delivery path to prevent DoS
|
* itimers in the signal delivery path to prevent DoS
|
||||||
* attacks in the high resolution timer case. This is
|
* attacks in the high resolution timer case. This is
|
||||||
* compliant with the old way of self restarting
|
* compliant with the old way of self-restarting
|
||||||
* itimers, as the SIGALRM is a legacy signal and only
|
* itimers, as the SIGALRM is a legacy signal and only
|
||||||
* queued once. Changing the restart behaviour to
|
* queued once. Changing the restart behaviour to
|
||||||
* restart the timer in the signal dequeue path is
|
* 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,
|
|||||||
if (info == SEND_SIG_FORCED)
|
if (info == SEND_SIG_FORCED)
|
||||||
goto out_set;
|
goto out_set;
|
||||||
|
|
||||||
/* Real-time signals must be queued if sent by sigqueue, or
|
/*
|
||||||
some other real-time mechanism. It is implementation
|
* Real-time signals must be queued if sent by sigqueue, or
|
||||||
defined whether kill() does so. We attempt to do so, on
|
* some other real-time mechanism. It is implementation
|
||||||
the principle of least surprise, but since kill is not
|
* defined whether kill() does so. We attempt to do so, on
|
||||||
allowed to fail with EAGAIN when low on memory we just
|
* the principle of least surprise, but since kill is not
|
||||||
make sure at least one signal gets delivered and don't
|
* allowed to fail with EAGAIN when low on memory we just
|
||||||
pass on the info struct. */
|
* make sure at least one signal gets delivered and don't
|
||||||
|
* pass on the info struct.
|
||||||
|
*/
|
||||||
if (sig < SIGRTMIN)
|
if (sig < SIGRTMIN)
|
||||||
override_rlimit = (is_si_special(info) || info->si_code >= 0);
|
override_rlimit = (is_si_special(info) || info->si_code >= 0);
|
||||||
else
|
else
|
||||||
@@ -1201,8 +1203,7 @@ retry:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
||||||
kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
@@ -1299,8 +1300,7 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
|
|||||||
* These are for backward compatibility with the rest of the kernel source.
|
* These are for backward compatibility with the rest of the kernel source.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
|
||||||
send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Make sure legacy kernel users don't send in bad values
|
* Make sure legacy kernel users don't send in bad values
|
||||||
@@ -1368,7 +1368,7 @@ EXPORT_SYMBOL(kill_pid);
|
|||||||
* These functions support sending signals using preallocated sigqueue
|
* These functions support sending signals using preallocated sigqueue
|
||||||
* structures. This is needed "because realtime applications cannot
|
* structures. This is needed "because realtime applications cannot
|
||||||
* afford to lose notifications of asynchronous events, like timer
|
* afford to lose notifications of asynchronous events, like timer
|
||||||
* expirations or I/O completions". In the case of Posix Timers
|
* expirations or I/O completions". In the case of POSIX Timers
|
||||||
* we allocate the sigqueue structure from the timer_create. If this
|
* we allocate the sigqueue structure from the timer_create. If this
|
||||||
* allocation fails we are able to report the failure to the application
|
* allocation fails we are able to report the failure to the application
|
||||||
* with an EAGAIN error.
|
* with an EAGAIN error.
|
||||||
@@ -1553,7 +1553,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
|
|||||||
info.si_signo = SIGCHLD;
|
info.si_signo = SIGCHLD;
|
||||||
info.si_errno = 0;
|
info.si_errno = 0;
|
||||||
/*
|
/*
|
||||||
* see comment in do_notify_parent() abot the following 3 lines
|
* see comment in do_notify_parent() about the following 4 lines
|
||||||
*/
|
*/
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
|
info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
|
||||||
@@ -1611,7 +1611,7 @@ static inline int may_ptrace_stop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return nonzero if there is a SIGKILL that should be waking us up.
|
* Return non-zero if there is a SIGKILL that should be waking us up.
|
||||||
* Called with the siglock held.
|
* Called with the siglock held.
|
||||||
*/
|
*/
|
||||||
static int sigkill_pending(struct task_struct *tsk)
|
static int sigkill_pending(struct task_struct *tsk)
|
||||||
@@ -1735,7 +1735,7 @@ void ptrace_notify(int exit_code)
|
|||||||
/*
|
/*
|
||||||
* This performs the stopping for SIGSTOP and other stop signals.
|
* This performs the stopping for SIGSTOP and other stop signals.
|
||||||
* We have to stop all threads in the thread group.
|
* We have to stop all threads in the thread group.
|
||||||
* Returns nonzero if we've actually stopped and released the siglock.
|
* Returns non-zero if we've actually stopped and released the siglock.
|
||||||
* Returns zero if we didn't stop and still hold the siglock.
|
* Returns zero if we didn't stop and still hold the siglock.
|
||||||
*/
|
*/
|
||||||
static int do_signal_stop(int signr)
|
static int do_signal_stop(int signr)
|
||||||
@@ -1823,10 +1823,12 @@ static int ptrace_signal(int signr, siginfo_t *info,
|
|||||||
|
|
||||||
current->exit_code = 0;
|
current->exit_code = 0;
|
||||||
|
|
||||||
/* Update the siginfo structure if the signal has
|
/*
|
||||||
changed. If the debugger wanted something
|
* Update the siginfo structure if the signal has
|
||||||
specific in the siginfo structure then it should
|
* changed. If the debugger wanted something
|
||||||
have updated *info via PTRACE_SETSIGINFO. */
|
* specific in the siginfo structure then it should
|
||||||
|
* have updated *info via PTRACE_SETSIGINFO.
|
||||||
|
*/
|
||||||
if (signr != info->si_signo) {
|
if (signr != info->si_signo) {
|
||||||
info->si_signo = signr;
|
info->si_signo = signr;
|
||||||
info->si_errno = 0;
|
info->si_errno = 0;
|
||||||
@@ -2034,7 +2036,8 @@ void exit_signals(struct task_struct *tsk)
|
|||||||
if (!signal_pending(tsk))
|
if (!signal_pending(tsk))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* It could be that __group_complete_signal() choose us to
|
/*
|
||||||
|
* It could be that __group_complete_signal() choose us to
|
||||||
* notify about group-wide signal. Another thread should be
|
* notify about group-wide signal. Another thread should be
|
||||||
* woken now to take the signal since we will not.
|
* woken now to take the signal since we will not.
|
||||||
*/
|
*/
|
||||||
@@ -2183,7 +2186,7 @@ long do_sigpending(void __user *set, unsigned long sigsetsize)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
|
SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
|
||||||
{
|
{
|
||||||
@@ -2233,9 +2236,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
|
|||||||
err |= __put_user(from->si_trapno, &to->si_trapno);
|
err |= __put_user(from->si_trapno, &to->si_trapno);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUS_MCEERR_AO
|
#ifdef BUS_MCEERR_AO
|
||||||
/*
|
/*
|
||||||
* Other callers might not initialize the si_lsb field,
|
* Other callers might not initialize the si_lsb field,
|
||||||
* so check explicitely for the right codes here.
|
* so check explicitly for the right codes here.
|
||||||
*/
|
*/
|
||||||
if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
|
if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
|
||||||
err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
|
err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
|
||||||
@@ -2280,7 +2283,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
|
|||||||
|
|
||||||
if (copy_from_user(&these, uthese, sizeof(these)))
|
if (copy_from_user(&these, uthese, sizeof(these)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invert the set of allowed signals to get those we
|
* Invert the set of allowed signals to get those we
|
||||||
* want to block.
|
* want to block.
|
||||||
@@ -2305,9 +2308,11 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
|
|||||||
+ (ts.tv_sec || ts.tv_nsec));
|
+ (ts.tv_sec || ts.tv_nsec));
|
||||||
|
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
/* None ready -- temporarily unblock those we're
|
/*
|
||||||
|
* None ready -- temporarily unblock those we're
|
||||||
* interested while we are sleeping in so that we'll
|
* interested while we are sleeping in so that we'll
|
||||||
* be awakened when they arrive. */
|
* be awakened when they arrive.
|
||||||
|
*/
|
||||||
current->real_blocked = current->blocked;
|
current->real_blocked = current->blocked;
|
||||||
sigandsets(¤t->blocked, ¤t->blocked, &these);
|
sigandsets(¤t->blocked, ¤t->blocked, &these);
|
||||||
recalc_sigpending();
|
recalc_sigpending();
|
||||||
@@ -2553,12 +2558,11 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
|
|||||||
|
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
/*
|
/*
|
||||||
*
|
* Note - this code used to test ss_flags incorrectly:
|
||||||
* Note - this code used to test ss_flags incorrectly
|
|
||||||
* old code may have been written using ss_flags==0
|
* old code may have been written using ss_flags==0
|
||||||
* to mean ss_flags==SS_ONSTACK (as this was the only
|
* to mean ss_flags==SS_ONSTACK (as this was the only
|
||||||
* way that worked) - this fix preserves that older
|
* way that worked) - this fix preserves that older
|
||||||
* mechanism
|
* mechanism.
|
||||||
*/
|
*/
|
||||||
if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
|
if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -2600,8 +2604,10 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __ARCH_WANT_SYS_SIGPROCMASK
|
#ifdef __ARCH_WANT_SYS_SIGPROCMASK
|
||||||
/* Some platforms have their own version with special arguments others
|
/*
|
||||||
support only sys_rt_sigprocmask. */
|
* Some platforms have their own version with special arguments;
|
||||||
|
* others support only sys_rt_sigprocmask.
|
||||||
|
*/
|
||||||
|
|
||||||
SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
|
SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
|
||||||
old_sigset_t __user *, oset)
|
old_sigset_t __user *, oset)
|
||||||
|
Reference in New Issue
Block a user