sched: improve thread handling on system calls
This commit is contained in:
parent
89672d02f4
commit
72827c1e00
9 changed files with 157 additions and 180 deletions
|
|
@ -25,27 +25,9 @@ void _start()
|
|||
|
||||
promptfd(fd);
|
||||
|
||||
char c[2];
|
||||
|
||||
ssize_t ret;
|
||||
while ((ret = read(fd, c, 1)) > 0) {
|
||||
if (c[0] == '\r')
|
||||
c[0] = '\n';
|
||||
|
||||
write(fd, c, 1);
|
||||
|
||||
if (c[0] == '\n') {
|
||||
write(fd, "attempting to fork\n", 19);
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid == 0) {
|
||||
write(fd, "child\n", 6);
|
||||
exit(0);
|
||||
} else {
|
||||
write(fd, "parent\n", 7);
|
||||
}
|
||||
}
|
||||
char buf[256];
|
||||
int n;
|
||||
while ((n = read(fd, buf, 256)) > 0) {
|
||||
write(fd, buf, n);
|
||||
}
|
||||
|
||||
exit(0x1234);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue