kernel: Add processes and rework VFS access checking #48

Merged
apio merged 5 commits from processes into main 2024-12-07 12:19:51 +00:00
3 changed files with 13 additions and 2 deletions
Showing only changes of commit d05d6fad0b - Show all commits

View File

@ -26,7 +26,7 @@ Result<u64> sys_waitpid(Registers* regs, SyscallArgs args)
wait_for_child:
if (!target->dead()) kernel_wait(pid);
if (current->interrupted && current->pending_signal() != SIGCHLD)
if (current->interrupted && (current->pending_signal_count() > 1 || current->pending_signal() != SIGCHLD))
{
kdbgln("signal: waitpid interrupted by signal");
if (current->will_ignore_pending_signal())
@ -50,7 +50,7 @@ Result<u64> sys_waitpid(Registers* regs, SyscallArgs args)
wait_for_any_child:
kernel_wait(pid);
if (current->interrupted && current->pending_signal() != SIGCHLD)
if (current->interrupted && (current->pending_signal_count() > 1 || current->pending_signal() != SIGCHLD))
{
kdbgln("signal: waitpid interrupted by signal");
if (current->will_ignore_pending_signal())

View File

@ -277,6 +277,16 @@ void Thread::process_pending_signals(Registers* current_regs)
}
}
int Thread::pending_signal_count()
{
int result = 0;
for (int i = 0; i < NSIG; i++)
{
if (pending_signals.get(i)) { result++; }
}
return result;
}
int Thread::pending_signal()
{
for (int i = 0; i < NSIG; i++)

View File

@ -208,6 +208,7 @@ struct Thread : public LinkedListNode<Thread>
void process_pending_signals(Registers* current_regs);
int pending_signal_count();
int pending_signal();
bool will_ignore_pending_signal();