X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/94a87fe25c5ec021daf16edd64058ed6a37aba7d..509574b18a3373030cd0d7b979499499ff06dd9b:/lunaix-os/kernel/sched.c diff --git a/lunaix-os/kernel/sched.c b/lunaix-os/kernel/sched.c index 7f124c4..8e5eecb 100644 --- a/lunaix-os/kernel/sched.c +++ b/lunaix-os/kernel/sched.c @@ -149,11 +149,12 @@ _wait(pid_t wpid, int* status, int options) return -1; } + wpid = wpid ? wpid : -__current->pgid; cpu_enable_interrupt(); repeat: llist_for_each(proc, n, &__current->children, siblings) { - if (!~wpid || proc->pid == wpid) { + if (!~wpid || proc->pid == wpid || proc->pgid == -wpid) { if (proc->state == PROC_TERMNAT && !options) { status_flags |= PROCTERM; goto done; @@ -209,8 +210,10 @@ push_process(struct proc_info* process) process = &sched_ctx._procs[index]; - // make sure the address is in the range of process table + // make sure the reference is relative to process table llist_init_head(&process->children); + llist_init_head(&process->grp_member); + // every process is the child of first process (pid=1) if (process->parent) { llist_append(&process->parent->children, &process->siblings);