diff options
author | Roland McGrath <roland@redhat.com> | 2005-01-04 05:38:01 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-04 05:38:01 -0800 |
commit | 183986a705d44c4fbff9658be13d5344fb2d6c4e (patch) | |
tree | 5d13b20d6af7942d2f1bee203be879c528e62b84 /kernel | |
parent | 0b4eff5d61471075a27b84b8a5348bca6d37d8e0 (diff) | |
download | history-183986a705d44c4fbff9658be13d5344fb2d6c4e.tar.gz |
[PATCH] move group_exit flag into signal_struct.flags word
After my last change, there are plenty of unused bits available in the new
flags word in signal_struct. This patch moves the `group_exit' flag into
one of those bits, saving a word in signal_struct.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 10 | ||||
-rw-r--r-- | kernel/fork.c | 3 | ||||
-rw-r--r-- | kernel/signal.c | 15 |
3 files changed, 16 insertions, 12 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index a3014674d72539..3aed197c6b858b 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -656,7 +656,7 @@ static void exit_notify(struct task_struct *tsk) struct task_struct *t; struct list_head ptrace_dead, *_p, *_n; - if (signal_pending(tsk) && !tsk->signal->group_exit + if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) && !thread_group_empty(tsk)) { /* * This occurs when there was a race between our exit @@ -879,18 +879,18 @@ do_group_exit(int exit_code) { BUG_ON(exit_code & 0x80); /* core dumps don't get here */ - if (current->signal->group_exit) + if (current->signal->flags & SIGNAL_GROUP_EXIT) exit_code = current->signal->group_exit_code; else if (!thread_group_empty(current)) { struct signal_struct *const sig = current->signal; struct sighand_struct *const sighand = current->sighand; read_lock(&tasklist_lock); spin_lock_irq(&sighand->siglock); - if (sig->group_exit) + if (sig->flags & SIGNAL_GROUP_EXIT) /* Another thread got here before we took the lock. */ exit_code = sig->group_exit_code; else { - sig->group_exit = 1; + sig->flags = SIGNAL_GROUP_EXIT; sig->group_exit_code = exit_code; zap_other_threads(current); } @@ -1070,7 +1070,7 @@ static int wait_task_zombie(task_t *p, int noreap, read_unlock(&tasklist_lock); retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; - status = p->signal->group_exit + status = (p->signal->flags & SIGNAL_GROUP_EXIT) ? p->signal->group_exit_code : p->exit_code; if (!retval && stat_addr) retval = put_user(status, stat_addr); diff --git a/kernel/fork.c b/kernel/fork.c index f92f424d87f4c5..f3a8a8d5db908d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -734,7 +734,6 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts atomic_set(&sig->count, 1); atomic_set(&sig->live, 1); sig->flags = 0; - sig->group_exit = 0; sig->group_exit_code = 0; sig->group_exit_task = NULL; sig->group_stop_count = 0; @@ -1000,7 +999,7 @@ static task_t *copy_process(unsigned long clone_flags, * do not create this new thread - the whole thread * group is supposed to exit anyway. */ - if (current->signal->group_exit) { + if (current->signal->flags & SIGNAL_GROUP_EXIT) { spin_unlock(¤t->sighand->siglock); write_unlock_irq(&tasklist_lock); retval = -EAGAIN; diff --git a/kernel/signal.c b/kernel/signal.c index 928b856861b075..b4eb8cb4016882 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -661,6 +661,12 @@ static void handle_stop_signal(int sig, struct task_struct *p) { struct task_struct *t; + if (p->flags & SIGNAL_GROUP_EXIT) + /* + * The process is in the middle of dying already. + */ + return; + if (sig_kernel_stop(sig)) { /* * This is a stop signal. Remove SIGCONT from all queues. @@ -976,7 +982,7 @@ __group_complete_signal(int sig, struct task_struct *p) * Found a killable thread. If the signal will be fatal, * then start taking the whole group down immediately. */ - if (sig_fatal(p, sig) && !p->signal->group_exit && + if (sig_fatal(p, sig) && !(p->signal->flags & SIGNAL_GROUP_EXIT) && !sigismember(&t->real_blocked, sig) && (sig == SIGKILL || !(t->ptrace & PT_PTRACED))) { /* @@ -989,10 +995,9 @@ __group_complete_signal(int sig, struct task_struct *p) * running and doing things after a slower * thread has the fatal signal pending. */ - p->signal->group_exit = 1; + p->signal->flags = SIGNAL_GROUP_EXIT; p->signal->group_exit_code = sig; p->signal->group_stop_count = 0; - p->signal->flags = 0; t = p; do { sigaddset(&t->pending.signal, SIGKILL); @@ -1079,8 +1084,8 @@ void zap_other_threads(struct task_struct *p) { struct task_struct *t; + p->signal->flags = SIGNAL_GROUP_EXIT; p->signal->group_stop_count = 0; - p->signal->flags = 0; if (thread_group_empty(p)) return; @@ -1785,7 +1790,7 @@ static inline int handle_group_stop(void) return 0; } - if (current->signal->group_exit) + if (current->signal->flags & SIGNAL_GROUP_EXIT) /* * Group stop is so another thread can do a core dump, * or else we are racing against a death signal. |