Kernel: Userspace sets the foreground process and Shell handles ^C

This commit is contained in:
Bananymous
2023-07-28 18:10:36 +03:00
parent 9279bbbd19
commit 925df39107
2 changed files with 25 additions and 1 deletions

View File

@@ -22,6 +22,9 @@ int main()
{
initialize_stdio();
if (signal(SIGINT, [](int) {}) == SIG_ERR)
perror("signal");
bool first = true;
while (true)
@@ -85,9 +88,15 @@ int main()
perror("fork");
break;
}
if (tcsetpgrp(0, pid) == -1)
perror("tcsetpgrp");
int status;
waitpid(pid, &status, 0);
if (tcsetpgrp(0, getpid()) == -1)
perror("tcsetpgrp");
}
}