summaryrefslogtreecommitdiffstats
path: root/winsup/testsuite/winsup.api/waitpid.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/testsuite/winsup.api/waitpid.c')
-rw-r--r--winsup/testsuite/winsup.api/waitpid.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c
new file mode 100644
index 000000000..9845cd1a4
--- /dev/null
+++ b/winsup/testsuite/winsup.api/waitpid.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <sys/wait.h>
+#include <errno.h>
+
+int
+main (int argc, char **argv)
+{
+ int pid, n;
+ if ((pid = fork ()) == 0)
+ exit (0);
+ sleep (2);
+ if ((n = waitpid (pid, NULL, 0)) != pid)
+ {
+ printf ("wait pid failed, pid %d, n %d, errno %d\n", pid, n, errno);
+ exit(1);
+ }
+ else
+ {
+ printf ("wait pid succeeded, pid %d, n %d, errno %d\n", pid, n, errno);
+ exit (0);
+ }
+}