25 const int signo = sig - 1;
26 char *
const ptr = (
char *) sigset;
35 const int signo = sig - 1;
36 char *
const ptr = (
char *) sigset;
45 const int signo = sig - 1;
46 const char *ptr = (
const char *) sigset;
81 case SIGSEGV:
return true;
86 case SIGPIPE:
return false;
96 pr_emerg(
"signal_send_to_thread(%pt, %d): cannot send non-fatal signal to kernel thread", (
void *) target, signal);
102 bool has_pending =
false;
105 has_pending |= pending->signal == signal;
128 if (target->
pid == 1 && signal == SIGKILL)
130 pr_emerg(
"signal_send_to_process(%pp, %d): cannot send SIGKILL to init", (
void *) target, signal);
134 if (target->
pid == 2)
136 pr_emerg(
"signal_send_to_process(%pp, %d): cannot send signal to kthreadd", (
void *) target, signal);
145 target_thread = thread;
156 target_thread = thread;
164 pr_emerg(
"signal_send_to_process(%pp, %d): no thread to send signal to", (
void *) target, signal);
185 pr_emerg(
"thread %pt received fatal signal %d but it was masked, terminating", (
void *)
current_thread, pending->signal);
192 signal = pending->signal;
202 if (action->
handler == SIG_DFL)
227 if (action->
handler == SIG_IGN)
238 .signal = next_signal,
239 .was_masked = was_masked,
271 reg_t real_ret = syscall_ret;
279 pr_dinfo2(signal,
"thread %pt will restart syscall %lu after signal %d", (
void *)
current_thread, syscall_nr, next_signal);
303 bool has_pending =
false;
#define MOS_UNREACHABLE_X(msg,...)
#define MOS_UNREACHABLE()
long signal_send_to_process(process_t *target, signal_t signal)
Send a signal to a process, an arbitrary thread will be chosen to receive the signal.
void signal_exit_to_user_prepare_syscall(platform_regs_t *regs, reg_t syscall_nr, reg_t syscall_ret)
Prepare to exit to userspace after a syscall.
void signal_on_returned(sigreturn_data_t *data)
Return from a signal handler.
long signal_send_to_thread(thread_t *target, signal_t signal)
Send a signal to a thread.
bool signal_has_pending(void)
Return true if there's a pending signal.
void signal_exit_to_user_prepare(platform_regs_t *regs)
Prepare to exit to userspace.
MOSAPI void linked_list_init(list_node_t *head_node)
Initialise a circular double linked list.
MOSAPI void list_node_append(list_node_t *head, list_node_t *item)
#define list_foreach(t, v, h)
Iterate over a list.
#define list_node(element)
Get the ‘list_node’ of a list element. This is exactly the reverse of ‘list_entry’ above.
#define list_remove(element)
void define_syscall thread_exit(void)
#define pr_emerg(fmt,...)
#define pr_dinfo2(feat, fmt,...)
void process_exit(process_t *process, u8 exit_code, signal_t signal)
void scheduler_wake_thread(thread_t *thread)
Wake a thread.
static void do_signal_exit_to_user_prepare(platform_regs_t *regs, signal_t next_signal, const sigaction_t *action)
static bool is_fatal_signal(signal_t signal)
static void signal_do_coredump(signal_t signal)
static int sigset_add(sigset_t *sigset, int sig)
static void signal_do_terminate(signal_t signal)
static int sigset_del(sigset_t *sigset, int sig)
static void signal_do_ignore(signal_t signal)
static int sigset_test(const sigset_t *sigset, int sig)
static signal_t signal_get_next_pending(void)
#define SLAB_AUTOINIT(name, var, type)
should_inline bool spinlock_is_locked(const spinlock_t *lock)
#define spinlock_acquire(lock)
#define spinlock_release(lock)
list_head pending
list of pending signals
thread_mode mode
user-mode thread or kernel-mode
thread_signal_info_t signal_info