* posix/test-vfork.c (main): Improve test to check for correct
	exit code.
This commit is contained in:
Ulrich Drepper 1999-01-19 15:41:14 +00:00
parent d53afacb55
commit d48f4d530e
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,8 @@
1999-01-19 Ulrich Drepper <drepper@cygnus.com>
* posix/test-vfork.c (main): Improve test to check for correct
exit code.
* sysdeps/unix/sysv/linux/i386/vfork.S: Rewrite to use clone.
* sysdeps/unix/sysv/linux/bits/sched.h: Define CLONE_VFORK.

View File

@ -6,10 +6,13 @@
void noop (void);
#define NR 2 /* Exit code of the child. */
int
main (void)
{
int pid;
pid_t pid;
int status;
printf ("Before vfork\n");
fflush (stdout);
@ -20,12 +23,14 @@ main (void)
machines where it is stored on the stack, if vfork wasn't
implemented correctly, */
noop ();
_exit (2);
_exit (NR);
}
else if (pid < 0)
error (1, errno, "vfork");
printf ("After vfork (parent)\n");
wait (0);
if (waitpid (0, &status, 0) != pid
|| !WIFEXITED (status) || WEXITSTATUS (NR))
exit (1);
exit (0);
}