Kernel: Make signals thread specific

This commit is contained in:
Bananymous
2023-07-21 18:58:17 +03:00
parent 8063700d7b
commit 40f7c6b8fa
4 changed files with 103 additions and 90 deletions

View File

@@ -158,10 +158,6 @@ namespace Kernel
userspace_info_t m_userspace_info;
ExitStatus m_exit_status;
vaddr_t m_signal_handlers[_SIGMAX + 1] { };
uint64_t m_signal_mask { (1ull << SIGCHLD) | (1ull << SIGURG) };
static_assert(_SIGMAX < 64);
BAN::UniqPtr<PageTable> m_page_table;
BAN::RefPtr<TTY> m_tty;
};

View File

@@ -1,10 +1,12 @@
#pragma once
#include <BAN/CircularQueue.h>
#include <BAN/NoCopyMove.h>
#include <BAN/RefPtr.h>
#include <BAN/UniqPtr.h>
#include <kernel/Memory/VirtualRange.h>
#include <signal.h>
#include <sys/types.h>
namespace Kernel
@@ -35,6 +37,8 @@ namespace Kernel
BAN::ErrorOr<Thread*> clone(Process*, uintptr_t rsp, uintptr_t rip);
void setup_exec();
void handle_signal(int signal, uintptr_t& return_rsp, uintptr_t& return_rip);
pid_t tid() const { return m_tid; }
void set_rsp(uintptr_t rsp) { m_rsp = rsp; validate_stack(); }
@@ -83,6 +87,12 @@ namespace Kernel
bool m_in_syscall { false };
bool m_is_userspace { false };
BAN::CircularQueue<int, 10> m_signal_queue;
vaddr_t m_signal_handlers[_SIGMAX + 1] { };
uint64_t m_signal_mask { (1ull << SIGCHLD) | (1ull << SIGURG) };
static_assert(_SIGMAX < 64);
friend class Process;
friend class Scheduler;
};