summaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-06-11 09:57:14 -0400
committerRobert Morris <[email protected]>2019-06-11 09:57:14 -0400
commit5753553213df8f9de851adb68377db43faecb91f (patch)
tree3b629ff54897fca414146677532cb459a2ed11ba /init.c
parent91ba81110acd3163f7de3580b677eece0c57f5e7 (diff)
downloadxv6-labs-5753553213df8f9de851adb68377db43faecb91f.tar.gz
xv6-labs-5753553213df8f9de851adb68377db43faecb91f.tar.bz2
xv6-labs-5753553213df8f9de851adb68377db43faecb91f.zip
separate source into kernel/ user/ mkfs/
Diffstat (limited to 'init.c')
-rw-r--r--init.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/init.c b/init.c
deleted file mode 100644
index 046b551..0000000
--- a/init.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// init: The initial user-level program
-
-#include "types.h"
-#include "stat.h"
-#include "user.h"
-#include "fcntl.h"
-
-char *argv[] = { "sh", 0 };
-
-int
-main(void)
-{
- int pid, wpid;
-
- if(open("console", O_RDWR) < 0){
- mknod("console", 1, 1);
- open("console", O_RDWR);
- }
- dup(0); // stdout
- dup(0); // stderr
-
- for(;;){
- printf(1, "init: starting sh\n");
- pid = fork();
- if(pid < 0){
- printf(1, "init: fork failed\n");
- exit();
- }
- if(pid == 0){
- exec("sh", argv);
- printf(1, "init: exec sh failed\n");
- exit();
- }
- while((wpid=wait()) >= 0 && wpid != pid)
- printf(1, "zombie!\n");
- }
-}