aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fork-sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fork-sleep.c')
-rw-r--r--tests/fork-sleep.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/fork-sleep.c b/tests/fork-sleep.c
new file mode 100644
index 0000000..f48c0b1
--- /dev/null
+++ b/tests/fork-sleep.c
@@ -0,0 +1,17 @@
+#include <time.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+ struct timespec ts = {0, 100000000L};
+ switch (fork()) {
+ case -1:
+ return 2;
+ case 0:
+ return 0;
+ default:
+ nanosleep(&ts, NULL);
+ return 1;
+ }
+}