diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-01-15 13:35:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-01-15 13:35:35 +0000 |
commit | d0ab77802ac748c07d7302aa728ad063ce98309f (patch) | |
tree | 43e3ce4213e33270d59cac7faafda4ac68fe8e5d /posix/test-vfork.c | |
parent | a58fe83962f6c0389fcd2215433547117059938a (diff) | |
download | glibc-d0ab77802ac748c07d7302aa728ad063ce98309f.tar glibc-d0ab77802ac748c07d7302aa728ad063ce98309f.tar.gz glibc-d0ab77802ac748c07d7302aa728ad063ce98309f.tar.bz2 glibc-d0ab77802ac748c07d7302aa728ad063ce98309f.zip |
Update.
* posix/Makefile (tests): Add test-vfork.
* posix/test-vfork.c: New file by Andreas Schwab.
Diffstat (limited to 'posix/test-vfork.c')
-rw-r--r-- | posix/test-vfork.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/posix/test-vfork.c b/posix/test-vfork.c new file mode 100644 index 0000000000..60abe0bcf7 --- /dev/null +++ b/posix/test-vfork.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <unistd.h> +#include <error.h> +#include <errno.h> + +void noop (void); + +int +main (void) +{ + int pid; + + printf ("Before vfork\n"); + fflush (stdout); + pid = vfork (); + if (pid == 0) + { + /* This will clobber the return pc from vfork in the parent on + machines where it is stored on the stack, if vfork wasn't + implemented correctly, */ + noop (); + _exit (2); + } + else if (pid < 0) + error (1, errno, "vfork"); + printf ("After vfork (parent)\n"); + wait (0); + exit (0); +} + +void +noop () +{ +} |