|
AquilaOS documentation
How it works, and its code
|
Go to the source code of this file.
Macros | |
| #define | SIG_MAX (NSIG - 1) |
| #define | SIGACT_ABORT 1 |
| #define | SIGACT_TERMINATE 2 |
| #define | SIGACT_IGNORE 3 |
| #define | SIGACT_STOP 4 |
| #define | SIGACT_CONTINUE 5 |
| #define | SIG_DFL ((uintptr_t) 0) |
| #define | SIG_IGN ((uintptr_t) 1) |
| #define | SIG_ERR ((uintptr_t) -1) |
| #define | WAIT_STOPPED 1 |
| #define | WAIT_CONTINUED 2 |
| #define | ERESTARTSYS 512 |
| #define | ERESTARTNOHAND 514 |
| #define | SIG_UNMASKABLE ((1UL << SIGKILL) | (1UL << SIGSTOP)) |
Functions | |
| int | signal_send (int pid, int sig) |
| Sends a signal as kill() does. | |
| int | signal_proc_send (struct proc *proc, int signal) |
| Sends a signal to a process. | |
| int | signal_pgrp_send (struct pgroup *pg, int signal) |
| Sends a signal to every process of a process group. | |
| void | signal_action_set (struct proc *proc, int sig) |
| Discards a pending signal that sigaction() just made ignored. | |
| void | signal_force (struct proc *proc, int signal) |
| Sends a signal that can't be blocked or ignored, such as the SIGSEGV of a fault: if the process blocks or ignores it, it is unblocked and its action reset to the default. | |
| int | signal_interrupts (struct thread *thread) |
| Says whether a thread has a signal to take, which ends a sleep that a signal may end. | |
| int | signal_take (void) |
| Takes the current process's pending signals, on the way back to user mode: ignored ones are dropped, and default actions are carried out (ending or stopping the process), until one with a handler is found. | |
| void | signal_exit (int sig) |
| Ends the current process because of a signal. | |
| int | signal_stops (struct proc *proc, int sig) |
| Says whether delivering a signal to a process would stop it: the signal isn't caught, and its default action is to stop. | |
| void | signal_stop (int sig) |
| Stops the current process, until SIGCONT or SIGKILL. | |
Variables | |
| int | sig_default_action [SIG_MAX+1] |
| #define ERESTARTNOHAND 514 |
Definition at line 82 of file signal.h.
Referenced by aarch64_return_to_user(), sys_nanosleep(), sys_poll(), sys_select(), sys_sigsuspend(), and x86_return_to_user().
| #define ERESTARTSYS 512 |
Definition at line 81 of file signal.h.
Referenced by aarch64_return_to_user(), sys_thread_join(), sys_waitpid(), tty_background(), waitq_sleep(), and x86_return_to_user().
| #define SIG_DFL ((uintptr_t) 0) |
Definition at line 26 of file signal.h.
Referenced by deliver(), deliver(), kproc_init(), proc_execve(), proc_new(), signal_force(), signal_ignored(), signal_stops(), signal_take(), and sys_sigaction().
| #define SIG_IGN ((uintptr_t) 1) |
Definition at line 27 of file signal.h.
Referenced by proc_execve(), proc_zombie_notify(), signal_force(), signal_ignored(), signal_take(), sys_sigaction(), and tty_background().
| #define SIG_MAX (NSIG - 1) |
Definition at line 16 of file signal.h.
Referenced by kproc_init(), proc_execve(), proc_new(), signal_send(), signal_to(), and sys_sigaction().
| #define SIG_UNMASKABLE ((1UL << SIGKILL) | (1UL << SIGSTOP)) |
Definition at line 85 of file signal.h.
Referenced by arch_sigreturn(), deliver(), deliver(), sys_select(), sys_sigmask(), and sys_sigsuspend().
| #define SIGACT_ABORT 1 |
Definition at line 19 of file signal.h.
Referenced by signal_take().
| #define SIGACT_CONTINUE 5 |
Definition at line 23 of file signal.h.
Referenced by signal_ignored().
| #define SIGACT_IGNORE 3 |
Definition at line 21 of file signal.h.
Referenced by signal_ignored().
| #define SIGACT_STOP 4 |
Definition at line 22 of file signal.h.
Referenced by signal_stops(), and signal_take().
| #define SIGACT_TERMINATE 2 |
Definition at line 20 of file signal.h.
Referenced by signal_take().
| #define WAIT_CONTINUED 2 |
Definition at line 68 of file signal.h.
Referenced by signal_stop(), signal_to(), and sys_waitpid().
| #define WAIT_STOPPED 1 |
Definition at line 67 of file signal.h.
Referenced by signal_stop(), signal_to(), and sys_waitpid().
| void signal_action_set | ( | struct proc * | proc, |
| int | sig ) |
Discards a pending signal that sigaction() just made ignored.
| proc | the process |
| sig | the signal whose action changed |
Definition at line 201 of file signal.c.
References proc::sig_pending, signal_action_set(), and signal_ignored().
Referenced by signal_action_set(), and sys_sigaction().
| void signal_exit | ( | int | sig | ) |
Ends the current process because of a signal.
It doesn't return.
| sig | the signal, which its parent's wait() reports |
Definition at line 245 of file signal.c.
References arch_sleep(), curproc, PROC_EXIT, proc_kill(), and signal_exit().
Referenced by deliver(), deliver(), signal_exit(), and signal_take().
| void signal_force | ( | struct proc * | proc, |
| int | signal ) |
Sends a signal that can't be blocked or ignored, such as the SIGSEGV of a fault: if the process blocks or ignores it, it is unblocked and its action reset to the default.
| proc | the process |
| signal | the signal |
Definition at line 230 of file signal.c.
References SIG_DFL, SIG_IGN, proc::sigaction, proc::sigmask, signal_force(), and signal_to().
Referenced by abort(), arch_sigreturn(), isr_dispatch(), signal_force(), and sync_dispatch().
| int signal_interrupts | ( | struct thread * | thread | ) |
Says whether a thread has a signal to take, which ends a sleep that a signal may end.
| thread | the thread |
Definition at line 215 of file signal.c.
References kproc, thread::owner, proc::sig_pending, proc::sigmask, and signal_interrupts().
Referenced by signal_interrupts(), and waitq_sleep().
| int signal_pgrp_send | ( | struct pgroup * | pg, |
| int | signal ) |
Sends a signal to every process of a process group.
| pg | the process group |
| signal | the signal |
Definition at line 322 of file signal.c.
References pgroup::procs, queue_for, signal_pgrp_send(), and signal_to().
Referenced by pgrp_orphaned_hangup(), signal_pgrp_send(), tty_background(), tty_hangup(), and tty_signal().
| int signal_proc_send | ( | struct proc * | proc, |
| int | signal ) |
Sends a signal to a process.
| proc | the process |
| signal | the signal (0 only checks that the process exists) |
Definition at line 310 of file signal.c.
References signal_proc_send(), and signal_to().
Referenced by kernel_ctrlaltdel(), mm_page_fault(), proc_zombie_notify(), sched_timer_tick(), signal_notify_parent(), signal_proc_send(), sys_send(), sys_write(), vt_signal(), and x86_fpu_trap().
| int signal_send | ( | pid_t | pid, |
| int | signal ) |
Sends a signal as kill() does.
| pid | whom to: a process if pid > 0, the caller's process group if 0, every process but init and the caller if -1, or process group -pid if < -1 |
| signal | the signal |
Definition at line 340 of file signal.c.
References curproc, kproc, pgroup::pgid, proc::pgrp, proc::pid, proc_pid_find(), procs, queue_for, proc::running, SIG_MAX, signal_send(), and signal_to().
Referenced by signal_send(), and sys_kill().
| void signal_stop | ( | int | sig | ) |
Stops the current process, until SIGCONT or SIGKILL.
Its thread calls this on its way back to user mode (signal_take()), and sleeps here; other signals don't end the sleep, only continuing (or killing) the process does.
| sig | the signal that stops it |
Definition at line 98 of file signal.c.
References curproc, signal_notify_parent(), signal_stop(), proc::stop_queue, proc::stopped, WAIT_CONTINUED, proc::wait_event, WAIT_STOPPED, and waitq_sleep_unint().
Referenced by signal_stop(), and signal_take().
| int signal_stops | ( | struct proc * | proc, |
| int | sig ) |
Says whether delivering a signal to a process would stop it: the signal isn't caught, and its default action is to stop.
| proc | the process |
| sig | the signal |
Definition at line 69 of file signal.c.
References sig_default_action, SIG_DFL, SIGACT_STOP, proc::sigaction, and signal_stops().
Referenced by signal_stops().
| int signal_take | ( | void | ) |
Takes the current process's pending signals, on the way back to user mode: ignored ones are dropped, and default actions are carried out (ending or stopping the process), until one with a handler is found.
Definition at line 262 of file signal.c.
References curproc, NULL, proc::pgrp, pgrp_orphaned(), ready, proc::running, sig_default_action, SIG_DFL, SIG_IGN, proc::sig_pending, SIGACT_ABORT, SIGACT_STOP, SIGACT_TERMINATE, proc::sigaction, proc::sigmask, signal_exit(), signal_stop(), and signal_take().
Referenced by aarch64_return_to_user(), signal_take(), and x86_return_to_user().
|
extern |
Definition at line 27 of file signal.c.
Referenced by signal_ignored(), signal_stops(), and signal_take().