SIGCHLD and wait4(), i.e. wait()/waitpid() implementation

This commit is contained in:
Balazs Gerofi bgerofi@riken.jp
2014-04-23 13:33:18 +09:00
parent 7103fed1dc
commit 0e348e6295
6 changed files with 315 additions and 14 deletions

View File

@@ -1156,6 +1156,19 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
break;
}
case __NR_wait4: {
int status;
int ret;
pid_t pid = w.sr.args[0];
if ((ret = waitpid(pid, &status, 0)) != pid) {
fprintf(stderr, "ERROR: waiting for %lu\n", w.sr.args[0]);
}
do_syscall_return(fd, cpu, ret, 0, 0, 0, 0);
break;
}
default:
ret = do_generic_syscall(&w);
do_syscall_return(fd, cpu, ret, 0, 0, 0, 0);