Implemented waitpid() a bit more; it now calls the _kern_wait_for_child() syscall.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8972 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-09-15 15:44:06 +00:00
parent 367fa74ad9
commit 25258635f7
+18 -2
View File
@@ -24,14 +24,30 @@ wait(int *_status)
pid_t pid_t
waitpid(pid_t pid, int *_status, int options) waitpid(pid_t pid, int *_status, int options)
{ {
fprintf(stderr, "waitpid(pid = %ld, options = %d): NOT IMPLEMENTED\n", pid, options); status_t returnCode;
return -1; int32 reason;
thread_id thread = _kern_wait_for_child(pid, options, &reason, &returnCode);
if (_status != NULL) {
// ToDo: fill in _status!
}
if (thread < B_OK) {
errno = thread;
if (thread == B_WOULD_BLOCK && (options & WNOHANG) != 0)
return 0;
return -1;
}
return thread;
} }
int int
waitid(idtype_t idType, id_t id, siginfo_t *info, int options) waitid(idtype_t idType, id_t id, siginfo_t *info, int options)
{ {
// waitid() is not available on BeOS so we may be lazy here and remove it...
fprintf(stderr, "waitid(): NOT IMPLEMENTED\n"); fprintf(stderr, "waitid(): NOT IMPLEMENTED\n");
return -1; return -1;
} }