summaryrefslogtreecommitdiff
path: root/init.c
blob: 983246b47cc200afd6d30862b378e073a4aa8752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
#include "fcntl.h"

char *sh_args[] = { "sh", 0 };

int
main(void)
{
  int pid;
  
  if(open("console", 0) < 0){
    mknod("console", T_DEV, 1, 1);
    open("console", 0);
  }
  open("console", 1);
  open("console", 1);

  while(1){
    pid = fork();
    if(pid == 0){
      exec("sh", sh_args);
      exit();
    }
    if(pid > 0)
      wait();
  }
}