coding style things. Signed-off-by: Andrew Morton --- 25-akpm/kernel/exit.c | 39 +++++++++++++++++++++++---------------- 25-akpm/kernel/signal.c | 4 ++-- 2 files changed, 25 insertions(+), 18 deletions(-) diff -puN kernel/exit.c~waitid-system-call-cleanups kernel/exit.c --- 25/kernel/exit.c~waitid-system-call-cleanups 2004-08-15 23:01:54.855807024 -0700 +++ 25-akpm/kernel/exit.c 2004-08-15 23:02:33.832881608 -0700 @@ -1013,6 +1013,7 @@ static int wait_task_zombie(task_t *p, i uid_t uid = p->uid; int exit_code = p->exit_code; int why, status; + if (unlikely(p->state != TASK_ZOMBIE)) return 0; if (unlikely(p->exit_signal == -1 && p->ptrace == 0)) @@ -1022,8 +1023,7 @@ static int wait_task_zombie(task_t *p, i if ((exit_code & 0x7f) == 0) { why = CLD_EXITED; status = exit_code >> 8; - } - else { + } else { why = (exit_code & 0x80) ? CLD_DUMPED : CLD_KILLED; status = exit_code & 0x7f; } @@ -1039,12 +1039,13 @@ static int wait_task_zombie(task_t *p, i BUG_ON(state != TASK_DEAD); return 0; } - if (unlikely(p->exit_signal == -1 && p->ptrace == 0)) + if (unlikely(p->exit_signal == -1 && p->ptrace == 0)) { /* * This can only happen in a race with a ptraced thread * dying on another processor. */ return 0; + } /* * Now we are sure this task is interesting, and no other @@ -1063,11 +1064,11 @@ static int wait_task_zombie(task_t *p, i retval = put_user(0, &infop->si_errno); if (!retval && infop) { int why; + if ((status & 0x7f) == 0) { why = CLD_EXITED; status >>= 8; - } - else { + } else { why = (status & 0x80) ? CLD_DUMPED : CLD_KILLED; status &= 0x7f; } @@ -1091,8 +1092,9 @@ static int wait_task_zombie(task_t *p, i __ptrace_unlink(p); p->state = TASK_ZOMBIE; /* - * If this is not a detached task, notify the parent. If it's - * still not detached after that, don't release it now. + * If this is not a detached task, notify the parent. + * If it's still not detached after that, don't release + * it now. */ if (p->exit_signal != -1) { do_notify_parent(p, p->exit_signal); @@ -1144,6 +1146,7 @@ static int wait_task_stopped(task_t *p, pid_t pid = p->pid; uid_t uid = p->uid; int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; + exit_code = p->exit_code; if (unlikely(!exit_code) || unlikely(p->state > TASK_STOPPED)) @@ -1178,7 +1181,7 @@ static int wait_task_stopped(task_t *p, * resumed, or it resumed and then died. */ write_unlock_irq(&tasklist_lock); - bail_ref: +bail_ref: put_task_struct(p); read_lock(&tasklist_lock); return 0; @@ -1270,7 +1273,7 @@ repeat: case TASK_DEAD: continue; default: - check_continued: +check_continued: if (!unlikely(options & WCONTINUED)) continue; if (unlikely(!p->signal)) @@ -1279,6 +1282,7 @@ repeat: if (p->signal->stop_state < 0) { pid_t pid; uid_t uid; + if (!(options & WNOWAIT)) p->signal->stop_state = 0; spin_unlock_irq(&p->sighand->siglock); @@ -1286,9 +1290,9 @@ repeat: uid = p->uid; get_task_struct(p); read_unlock(&tasklist_lock); - retval = wait_noreap_copyout( - p, pid, uid, - CLD_CONTINUED, SIGCONT, infop); + retval = wait_noreap_copyout(p, pid, + uid, CLD_CONTINUED, + SIGCONT, infop); BUG_ON(retval == 0); goto end; } @@ -1297,8 +1301,9 @@ repeat: } } if (!flag) { - list_for_each (_p,&tsk->ptrace_children) { - p = list_entry(_p,struct task_struct,ptrace_list); + list_for_each(_p, &tsk->ptrace_children) { + p = list_entry(_p, struct task_struct, + ptrace_list); if (!eligible_child(pid, options, p)) continue; flag = 1; @@ -1311,6 +1316,7 @@ repeat: if (tsk->signal != current->signal) BUG(); } while (tsk != current); + read_unlock(&tasklist_lock); if (flag) { retval = 0; @@ -1323,7 +1329,7 @@ repeat: goto repeat; } retval = -ECHILD; - end: +end: current->state = TASK_RUNNING; remove_wait_queue(¤t->wait_chldexit,&wait); if (infop && retval > 0) @@ -1359,7 +1365,8 @@ asmlinkage long sys_waitid(int which, pi return do_wait(pid, options, infop, NULL, &infop->si_rusage); } -asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru) +asmlinkage long sys_wait4(pid_t pid, unsigned int *stat_addr, + int options, struct rusage *ru) { if (options & ~(WNOHANG|WUNTRACED|__WNOTHREAD|__WCLONE|__WALL)) return -EINVAL; diff -puN kernel/signal.c~waitid-system-call-cleanups kernel/signal.c --- 25/kernel/signal.c~waitid-system-call-cleanups 2004-08-15 23:01:54.856806872 -0700 +++ 25-akpm/kernel/signal.c 2004-08-15 23:01:54.864805656 -0700 @@ -1562,9 +1562,9 @@ do_notify_parent_cldstop(struct task_str if (info.si_status == 0) { info.si_status = SIGCONT; info.si_code = CLD_CONTINUED; - } - else + } else { info.si_code = CLD_STOPPED; + } sighand = parent->sighand; spin_lock_irqsave(&sighand->siglock, flags); _