4357207237
no more cons_put system calls usertests tests two processes writing files
33 lines
456 B
C
33 lines
456 B
C
#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);
|
|
|
|
puts("init...\n");
|
|
|
|
while(1){
|
|
puts("running sh...\n");
|
|
pid = fork();
|
|
if(pid == 0){
|
|
exec("sh", sh_args);
|
|
exit();
|
|
}
|
|
if(pid > 0)
|
|
wait();
|
|
}
|
|
}
|