Fixes to get nptl compiling for x86
[uclibc-ng.git] / test / unistd / vfork.c
blob295583945054921a69f072c127b07c7d0a48a50c
1 /* vi: set sw=4 ts=4: */
2 /*
3 * vfork test for uClibc
4 * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 */
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <sys/wait.h>
13 #include <sys/types.h>
16 int main(void)
18 pid_t pid;
19 int status, wpid;
20 char *argv[] = {
21 "/bin/ls",
22 "-laF",
23 NULL,
26 clearenv();
27 if ((pid = vfork()) == 0) {
28 printf("Hi. I'm the child process...\n");
29 execvp(argv[0], argv);
30 _exit(0);
33 printf("Hello. I'm the parent process.\n");
34 while (1) {
35 wpid = wait(&status);
36 if (wpid > 0 && wpid != pid) {
37 continue;
39 if (wpid == pid)
40 break;
43 printf("Child process exited.\nGoodbye.\n");
44 return EXIT_SUCCESS;
48 Local Variables:
49 c-file-style: "linux"
50 c-basic-offset: 4
51 tab-width: 4
52 End: