From fbb0ac2170d4d8053911e66c6676572a0eb1434f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 15 Sep 2004 15:48:28 +0000 Subject: [PATCH] fork() now at least calls _kern_fork(), but would not even be complete if that one worked. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8975 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/fork.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/fork.c b/src/kernel/libroot/posix/unistd/fork.c index 33e8aca451..dc084fb6eb 100644 --- a/src/kernel/libroot/posix/unistd/fork.c +++ b/src/kernel/libroot/posix/unistd/fork.c @@ -7,16 +7,21 @@ #include #include -#include #include pid_t fork(void) { - // ToDo: implement me - // ToDo: atfork() - fprintf(stderr, "fork(): NOT IMPLEMENTED\n"); - return -1; + thread_id thread = _kern_fork(); + if (thread < 0) { + errno = thread; + return -1; + } + + // ToDo: initialize child + // ToDo: atfork() support + + return thread; }