aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-03-28 19:11:18 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 21:36:43 -0500
commit6a14c5c9da0b4c34b5be783403c54f0396fcfe77 (patch)
tree63e40e5761eb5327ae4f713b284c67128cb4d261 /kernel/signal.c
parentc81addc9d3a0ebff2155e0cd86f90820ab97147e (diff)
[PATCH] move __exit_signal() to kernel/exit.c
__exit_signal() is private to release_task() now. I think it is better to make it static in kernel/exit.c and export flush_sigqueue() instead - this function is much more simple and straightforward. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c65
1 files changed, 1 insertions, 64 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index b29c868bd5ee..6ea49f742a2f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -22,7 +22,6 @@
22#include <linux/security.h> 22#include <linux/security.h>
23#include <linux/syscalls.h> 23#include <linux/syscalls.h>
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/posix-timers.h>
26#include <linux/signal.h> 25#include <linux/signal.h>
27#include <linux/audit.h> 26#include <linux/audit.h>
28#include <linux/capability.h> 27#include <linux/capability.h>
@@ -295,7 +294,7 @@ static void __sigqueue_free(struct sigqueue *q)
295 kmem_cache_free(sigqueue_cachep, q); 294 kmem_cache_free(sigqueue_cachep, q);
296} 295}
297 296
298static void flush_sigqueue(struct sigpending *queue) 297void flush_sigqueue(struct sigpending *queue)
299{ 298{
300 struct sigqueue *q; 299 struct sigqueue *q;
301 300
@@ -322,68 +321,6 @@ void flush_signals(struct task_struct *t)
322} 321}
323 322
324/* 323/*
325 * This function expects the tasklist_lock write-locked.
326 */
327void __exit_signal(struct task_struct *tsk)
328{
329 struct signal_struct *sig = tsk->signal;
330 struct sighand_struct *sighand;
331
332 BUG_ON(!sig);
333 BUG_ON(!atomic_read(&sig->count));
334
335 rcu_read_lock();
336 sighand = rcu_dereference(tsk->sighand);
337 spin_lock(&sighand->siglock);
338
339 posix_cpu_timers_exit(tsk);
340 if (atomic_dec_and_test(&sig->count))
341 posix_cpu_timers_exit_group(tsk);
342 else {
343 /*
344 * If there is any task waiting for the group exit
345 * then notify it:
346 */
347 if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count) {
348 wake_up_process(sig->group_exit_task);
349 sig->group_exit_task = NULL;
350 }
351 if (tsk == sig->curr_target)
352 sig->curr_target = next_thread(tsk);
353 /*
354 * Accumulate here the counters for all threads but the
355 * group leader as they die, so they can be added into
356 * the process-wide totals when those are taken.
357 * The group leader stays around as a zombie as long
358 * as there are other threads. When it gets reaped,
359 * the exit.c code will add its counts into these totals.
360 * We won't ever get here for the group leader, since it
361 * will have been the last reference on the signal_struct.
362 */
363 sig->utime = cputime_add(sig->utime, tsk->utime);
364 sig->stime = cputime_add(sig->stime, tsk->stime);
365 sig->min_flt += tsk->min_flt;
366 sig->maj_flt += tsk->maj_flt;
367 sig->nvcsw += tsk->nvcsw;
368 sig->nivcsw += tsk->nivcsw;
369 sig->sched_time += tsk->sched_time;
370 sig = NULL; /* Marker for below. */
371 }
372
373 tsk->signal = NULL;
374 cleanup_sighand(tsk);
375 spin_unlock(&sighand->siglock);
376 rcu_read_unlock();
377
378 clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
379 flush_sigqueue(&tsk->pending);
380 if (sig) {
381 flush_sigqueue(&sig->shared_pending);
382 __cleanup_signal(sig);
383 }
384}
385
386/*
387 * Flush all handlers for a task. 324 * Flush all handlers for a task.
388 */ 325 */
389 326