diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-07-04 19:57:57 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-07-04 19:57:57 +0000 |
commit | a6cac46c1741cc686da46585c16b17c2acb9f416 (patch) | |
tree | 4524296c7f69c182b0592e483cca07c90c081a7e /newlib/libc/sys/linux/process.c | |
parent | 30b2092fcb3283a42447e47a549e216fd90945ec (diff) | |
download | cygnal-a6cac46c1741cc686da46585c16b17c2acb9f416.tar.gz cygnal-a6cac46c1741cc686da46585c16b17c2acb9f416.tar.bz2 cygnal-a6cac46c1741cc686da46585c16b17c2acb9f416.zip |
* libtool.m4: New file.
* libc/sys/linux/process.c: Implement vfork in terms of fork,
rather than as a syscall.
Diffstat (limited to 'newlib/libc/sys/linux/process.c')
-rw-r--r-- | newlib/libc/sys/linux/process.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/newlib/libc/sys/linux/process.c b/newlib/libc/sys/linux/process.c index 0419ec7ef..8ae58b0c5 100644 --- a/newlib/libc/sys/linux/process.c +++ b/newlib/libc/sys/linux/process.c @@ -4,6 +4,7 @@ #include <sys/unistd.h> +#include <sys/wait.h> #include <machine/syscall.h> @@ -11,7 +12,6 @@ #define __NR__execve __NR_execve _syscall0(int,fork) -_syscall0(pid_t,vfork) _syscall3(int,_execve,const char *,file,char * const *,argv,char * const *,envp) _syscall0(int,getpid) _syscall2(int,setpgid,pid_t,pid,pid_t,pgid) @@ -21,6 +21,25 @@ _syscall0(pid_t,setsid) weak_alias(__libc_getpid,__getpid); +pid_t vfork(void) +{ + pid_t pid; + + pid = fork(); + + if(!pid) + { + /* In child. */ + return 0; + } + else + { + /* In parent. Wait for child to finish. */ + if (waitpid (pid, NULL, 0) < 0) + return pid; + } +} + /* FIXME: get rid of noreturn warning */ #define return for (;;) |