Kernel/LibC: Implement sigsuspend

This commit is contained in:
2025-08-20 20:14:54 +03:00
parent 49122cf729
commit 247743ef9c
6 changed files with 38 additions and 0 deletions

View File

@@ -193,6 +193,7 @@ namespace Kernel
BAN::ErrorOr<long> sys_sigaction(int signal, const struct sigaction* act, struct sigaction* oact);
BAN::ErrorOr<long> sys_sigpending(sigset_t* set);
BAN::ErrorOr<long> sys_sigprocmask(int how, const sigset_t* set, sigset_t* oset);
BAN::ErrorOr<long> sys_sigsuspend(const sigset_t* set);
BAN::ErrorOr<long> sys_futex(int op, const uint32_t* addr, uint32_t val, const timespec* abstime);
BAN::ErrorOr<long> sys_yield();

View File

@@ -1,6 +1,7 @@
#pragma once
#include <BAN/NoCopyMove.h>
#include <BAN/Optional.h>
#include <BAN/RefPtr.h>
#include <BAN/UniqPtr.h>
#include <kernel/InterruptStack.h>
@@ -60,6 +61,7 @@ namespace Kernel
// Returns true if handled signal had SA_RESTART
bool handle_signal(int signal = 0);
void add_signal(int signal);
void set_suspend_signal_mask(uint64_t sigmask);
// blocks current thread and returns either on unblock, eintr, spuriously or after timeout
// if mutex is not nullptr, it will be atomically freed before blocking and automatically locked on wake
@@ -160,6 +162,7 @@ namespace Kernel
uint64_t m_signal_pending_mask { 0 };
uint64_t m_signal_block_mask { 0 };
BAN::Optional<uint64_t> m_signal_suspend_mask;
SpinLock m_signal_lock;
static_assert(_SIGMAX < 64);