Kernel: Userspace signal handlers are now called one at a time

I added a syscall for telling the kernel when signal execution has
finished. We should send a random hash or id to the signal trampoline
that we would include in the syscall, so validity of signal exit can
be confirmed.
This commit is contained in:
Bananymous
2023-07-23 13:09:04 +03:00
parent d560137ae6
commit 2dce0a0415
9 changed files with 77 additions and 6 deletions

View File

@@ -281,6 +281,39 @@ int execute_command(BAN::Vector<BAN::String>& args)
return 1;
}
}
else if (args.front() == "signal-test"sv)
{
pid_t pid = fork();
if (pid == 0)
{
if (signal(SIGSEGV, [](int) { printf("SIGSEGV\n"); }) == SIG_ERR)
{
perror("signal");
exit(1);
}
printf("child\n");
for (;;);
}
if (pid == -1)
{
perror("fork");
return 1;
}
sleep(1);
if (kill(pid, SIGSEGV) == -1)
{
perror("kill");
return 1;
}
sleep(1);
if (kill(pid, SIGTERM) == -1)
{
perror("kill");
return 1;
}
}
else if (args.front() == "cd"sv)
{
if (args.size() > 2)