* wait_for_child() now behaves correctly when waiting for children of a specific

process group. This fixes bug #996.
* As a result, the process group stuff and wait_for_child() got much simpler;
  get_death_entry() and update_wait_for_any() could go away completely.
* If a team goes away, all of its children are now "reparented" to the kernel team,
  instead of the team's parent - this follows common implementations (and POSIX if
  I understand it correctly), but not BeOS anymore. The OpenGroup Base says this
  about this topic: "If a parent process terminates without waiting for all of its
  child processes to terminate, the remaining child processes shall be assigned a
  new parent process ID corresponding to an implementation-defined system process."
* We wait too long in wait_test_4 which at least puts us on par with Linux; see
  comment in _user_setpgid().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-29 15:33:31 +00:00
parent 56a16fd0f9
commit 2e27874523
3 changed files with 60 additions and 163 deletions
+2 -5
View File
@@ -579,7 +579,7 @@ _dump_thread_info(struct thread *thread)
kprintf(" exit.signal: 0x%x\n", thread->exit.signal);
kprintf(" exit.waiters:\n");
while ((death = list_get_next_item(&thread->exit.waiters, death)) != NULL) {
kprintf("\t%p (team 0x%lx, thread 0x%lx)\n", death, death->team, death->thread);
kprintf("\t%p (group 0x%lx, thread 0x%lx)\n", death, death->group_id, death->thread);
}
kprintf("kernel_stack_area: 0x%lx\n", thread->kernel_stack_area);
@@ -972,7 +972,7 @@ thread_exit(void)
// put a death entry into the dead children list of our parent
death = (struct death_entry *)malloc(sizeof(struct death_entry));
if (death != NULL) {
death->team = team->id;
death->group_id = team->group_id;
death->thread = thread->id;
death->status = thread->exit.status;
death->reason = thread->exit.reason;
@@ -1023,11 +1023,8 @@ thread_exit(void)
// TODO: should that be moved to handle_signal() (for SIGCHLD)?
release_sem_etc(parent->dead_children.sem,
parent->dead_children.waiters, B_DO_NOT_RESCHEDULE);
release_sem_etc(team->group->dead_child_sem,
team->group->dead_child_waiters, B_DO_NOT_RESCHEDULE);
parent->dead_children.waiters = 0;
team->group->dead_child_waiters = 0;
} else
RELEASE_THREAD_LOCK();