aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/kthread.c17
-rw-r--r--kernel/signal.c10
3 files changed, 14 insertions, 15 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index bc982cd72743..b0c6f0c3a2df 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -347,7 +347,7 @@ int disallow_signal(int sig)
347 return -EINVAL; 347 return -EINVAL;
348 348
349 spin_lock_irq(&current->sighand->siglock); 349 spin_lock_irq(&current->sighand->siglock);
350 sigaddset(&current->blocked, sig); 350 current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN;
351 recalc_sigpending(); 351 recalc_sigpending();
352 spin_unlock_irq(&current->sighand->siglock); 352 spin_unlock_irq(&current->sighand->siglock);
353 return 0; 353 return 0;
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 0eb0070a3c57..df8a8e8f6ca4 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -215,24 +215,13 @@ EXPORT_SYMBOL(kthread_stop);
215static __init void kthreadd_setup(void) 215static __init void kthreadd_setup(void)
216{ 216{
217 struct task_struct *tsk = current; 217 struct task_struct *tsk = current;
218 struct k_sigaction sa;
219 sigset_t blocked;
220 218
221 set_task_comm(tsk, "kthreadd"); 219 set_task_comm(tsk, "kthreadd");
222 220
223 /* Block and flush all signals */ 221 ignore_signals(tsk);
224 sigfillset(&blocked);
225 sigprocmask(SIG_BLOCK, &blocked, NULL);
226 flush_signals(tsk);
227 222
228 /* SIG_IGN makes children autoreap: see do_notify_parent(). */ 223 set_user_nice(tsk, -5);
229 sa.sa.sa_handler = SIG_IGN; 224 set_cpus_allowed(tsk, CPU_MASK_ALL);
230 sa.sa.sa_flags = 0;
231 siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
232 do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
233
234 set_user_nice(current, -5);
235 set_cpus_allowed(current, CPU_MASK_ALL);
236} 225}
237 226
238int kthreadd(void *unused) 227int kthreadd(void *unused)
diff --git a/kernel/signal.c b/kernel/signal.c
index 23ae6d62fc41..2ac3a668d9dd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -209,6 +209,16 @@ void flush_signals(struct task_struct *t)
209 spin_unlock_irqrestore(&t->sighand->siglock, flags); 209 spin_unlock_irqrestore(&t->sighand->siglock, flags);
210} 210}
211 211
212void ignore_signals(struct task_struct *t)
213{
214 int i;
215
216 for (i = 0; i < _NSIG; ++i)
217 t->sighand->action[i].sa.sa_handler = SIG_IGN;
218
219 flush_signals(t);
220}
221
212/* 222/*
213 * Flush all handlers for a task. 223 * Flush all handlers for a task.
214 */ 224 */