Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.5.75 /kernel/exit.c

Filename:/kernel/exit.c
Lines Added:13
Lines Deleted:4
Also changed in: (Previous) 2.5.74-bk7  2.5.74-bk6  2.5.74-bk5  2.5.74-bk4  2.5.74-bk3  2.5.74-bk2 
(Following)

Location
[  2.5.75
  [  kernel
     o  exit.c

Patch

diff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c   Thu Jul 10 13:16:28 2003
+++ b/kernel/exit.c   Thu Jul 10 13:16:28 2003
@@ -230,6 +230,7 @@
    /* signals? */
    security_task_reparent_to_init(current);
    memcpy(current->rlim, init_task.rlim, sizeof(*(current->rlim)));
+   atomic_inc(&(INIT_USER->__count));
    switch_uid(INIT_USER);
 
    write_unlock_irq(&tasklist_lock);
@@ -442,7 +443,7 @@
    /* more a memory barrier than a real lock */
    task_lock(tsk);
    tsk->mm = NULL;
-   enter_lazy_tlb(mm, current, smp_processor_id());
+   enter_lazy_tlb(mm, current);
    task_unlock(tsk);
    mmput(mm);
 }
@@ -651,6 +652,8 @@
    if (tsk->exit_signal != -1) {
       int signal = tsk->parent == tsk->real_parent ? tsk->exit_signal : SIGCHLD;
       do_notify_parent(tsk, signal);
+   } else if (tsk->ptrace) {
+      do_notify_parent(tsk, SIGCHLD);
    }
 
    tsk->state = TASK_ZOMBIE;
@@ -680,6 +683,8 @@
       panic("Attempted to kill the idle task!");
    if (unlikely(tsk->pid == 1))
       panic("Attempted to kill init!");
+   if (tsk->io_context)
+      exit_io_context();
    tsk->flags |= PF_EXITING;
    del_timer_sync(&tsk->real_timer);
 
@@ -715,7 +720,7 @@
    tsk->exit_code = code;
    exit_notify(tsk);
 
-   if (tsk->exit_signal == -1)
+   if (tsk->exit_signal == -1 && tsk->ptrace == 0)
       release_task(tsk);
 
    schedule();
@@ -859,7 +864,7 @@
       BUG_ON(state != TASK_DEAD);
       return 0;
    }
-   if (unlikely(p->exit_signal == -1))
+   if (unlikely(p->exit_signal == -1 && p->ptrace == 0))
       /*
        * This can only happen in a race with a ptraced thread
        * dying on another processor.
@@ -889,8 +894,12 @@
       /* Double-check with lock held.  */
       if (p->real_parent != p->parent) {
          __ptrace_unlink(p);
-         do_notify_parent(p, p->exit_signal);
          p->state = TASK_ZOMBIE;
+         /* If this is a detached thread, this is where it goes away.  */
+         if (p->exit_signal == -1)
+            release_task (p);
+         else
+            do_notify_parent(p, p->exit_signal);
          p = NULL;
       }
       write_unlock_irq(&tasklist_lock);


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.