diff uprogs/zombie.c @ 0:ed10291ff195

first commit
author mir3636
date Sun, 06 Jan 2019 19:27:03 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uprogs/zombie.c	Sun Jan 06 19:27:03 2019 +0900
@@ -0,0 +1,18 @@
+// Create a zombie process that 
+// must be reparented at exit.
+
+#include "types.h"
+#include "stat.h"
+#include "user.h"
+
+int
+main(void)
+{
+  if(fork() > 0){
+    sleep(5);  // Let child exit before parent.
+    printf(2, "Parent exits!\n");
+    exit();
+  }
+  printf(2, "Child exits!\n");
+  exit();
+}