2006-08-11 13:55:18 +00:00
|
|
|
#include "user.h"
|
|
|
|
#include "types.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);
|
|
|
|
|
2006-08-12 11:38:57 +00:00
|
|
|
puts("init...\n");
|
2006-08-11 13:55:18 +00:00
|
|
|
|
|
|
|
while(1){
|
2006-08-12 11:38:57 +00:00
|
|
|
puts("running sh...\n");
|
2006-08-11 13:55:18 +00:00
|
|
|
pid = fork();
|
|
|
|
if(pid == 0){
|
|
|
|
exec("sh", sh_args);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if(pid > 0)
|
|
|
|
wait();
|
|
|
|
}
|
|
|
|
}
|