10 #include "sys/list_head.h"
143 #define SA_NOCLDSTOP 0x00000001U
144 #define SA_NOCLDWAIT 0x00000002U
145 #define SA_SIGINFO 0x00000004U
146 #define SA_ONSTACK 0x08000000U
147 #define SA_RESTART 0x10000000U
148 #define SA_NODEFER 0x40000000U
149 #define SA_RESETHAND 0x80000000U
156 #define SIG_DFL ((sighandler_t)0)
157 #define SIG_IGN ((sighandler_t)1)
158 #define SIG_ERR ((sighandler_t)-1)
244 #define SEND_SIG_NOINFO ((siginfo_t *)0)
signed int pid_t
The type of process id.
Definition: types.h:9
signal_type_t
Signal codes.
Definition: signal.h:14
@ SIGTTOU
Terminal output for background process.
Definition: signal.h:41
@ SIGURG
Urgent condition on socket.
Definition: signal.h:35
@ SIGQUIT
Issued if the user sends a quit signal (Ctrl + D).
Definition: signal.h:17
@ SIGXCPU
CPU time limit exceeded.
Definition: signal.h:44
@ SIGPROF
Profiling timer expired.
Definition: signal.h:43
@ SIGILL
Illegal Instruction.
Definition: signal.h:18
@ SIGXFSZ
File size limit exceeded.
Definition: signal.h:45
@ SIGCONT
Continue if stopped.
Definition: signal.h:39
@ SIGWINCH
Window resize signal.
Definition: signal.h:34
@ SIGABRT
Abort signal from abort().
Definition: signal.h:20
@ SIGSYS
Bad system call (SVr4).
Definition: signal.h:26
@ SIGTERM
Software termination signal (sent by kill by default).
Definition: signal.h:29
@ SIGSEGV
Invalid memory reference.
Definition: signal.h:25
@ SIGUSR1
User-defined signal 1.
Definition: signal.h:30
@ SIGCHLD
Child stopped or terminated.
Definition: signal.h:32
@ SIGPWR
Power failure.
Definition: signal.h:33
@ SIGEMT
Emulator trap.
Definition: signal.h:21
@ SIGHUP
Hang up detected on controlling terminal or death of controlling process.
Definition: signal.h:15
@ SIGTTIN
Terminal input for background process.
Definition: signal.h:40
@ SIGINT
Issued if the user sends an interrupt signal (Ctrl + C).
Definition: signal.h:16
@ SIGTSTP
Stop typed at terminal.
Definition: signal.h:38
@ SIGKILL
If a process gets this signal it must quit immediately and will not perform any clean-up operations.
Definition: signal.h:23
@ SIGFPE
Floating-point arithmetic exception.
Definition: signal.h:22
@ SIGPOLL
Pollable event.
Definition: signal.h:36
@ SIGUSR2
User-defined signal 2.
Definition: signal.h:31
@ SIGPIPE
Broken pipe: write to pipe with no readers.
Definition: signal.h:27
@ SIGTRAP
Trace/breakpoint trap.
Definition: signal.h:19
@ SIGALRM
Alarm clock signal (used for timers).
Definition: signal.h:28
@ SIGSTOP
Stop process.
Definition: signal.h:37
@ SIGBUS
Bus error (bad memory access).
Definition: signal.h:24
@ SIGVTALRM
Virtual alarm clock.
Definition: signal.h:42
int sys_sigaction(int signum, const sigaction_t *act, sigaction_t *oldact, uint32_t sigreturn_addr)
Examine and change a signal action.
Definition: signal.c:772
signal_sender_code_t
Codes that indentify the sender of a signal.
Definition: signal.h:50
@ POLL_OUT
Output buffers available.
Definition: signal.h:120
@ ILL_ILLOPC
Illegal opcode.
Definition: signal.h:70
@ CLD_STOPPED
Child has stopped.
Definition: signal.h:114
@ SEGV_MAPERR
Address not mapped.
Definition: signal.h:92
@ FPE_FLTINV
Invalid floating point operation.
Definition: signal.h:87
@ CLD_KILLED
Child has terminated abnormally and did not create a core file.
Definition: signal.h:111
@ CLD_EXITED
Child has exited.
Definition: signal.h:110
@ SEGV_ACCERR
Invalid permissions.
Definition: signal.h:93
@ ILL_ILLTRP
Illegal trap.
Definition: signal.h:73
@ POLL_IN
Data input available.
Definition: signal.h:119
@ BUS_OBJERR
Object-specific hardware error.
Definition: signal.h:99
@ FPE_INTOVF
Integer overflow.
Definition: signal.h:82
@ BUS_ADRALN
Invalid address alignment.
Definition: signal.h:97
@ CLD_DUMPED
Child has terminated abnormally and created a core file.
Definition: signal.h:112
@ FPE_INTDIV
Integer divide-by-zero.
Definition: signal.h:81
@ ILL_PRVOPC
Privileged opcode.
Definition: signal.h:74
@ FPE_FLTSUB
Subscript out of range.
Definition: signal.h:88
@ ILL_ILLADR
Illegal addressing mode.
Definition: signal.h:72
@ POLL_PRI
High priority input available.
Definition: signal.h:123
@ SI_ASYNCIO
Signal was generated by completion of an asynchronous I/O request.
Definition: signal.h:65
@ SI_MESGQ
Signal was generated by arrival of a message on an empty message queue.
Definition: signal.h:66
@ TRAP_TRACE
Process trace trap.
Definition: signal.h:104
@ TRAP_BRKPT
Process breakpoint.
Definition: signal.h:103
@ SI_NOINFO
Unable to determine complete signal information.
Definition: signal.h:51
@ BUS_ADRERR
Non-existent physical address.
Definition: signal.h:98
@ CLD_TRAPPED
Traced child has trapped.
Definition: signal.h:113
@ FPE_FLTRES
Floating point inexact result.
Definition: signal.h:86
@ SI_QUEUE
Signal was sent by sigqueue().
Definition: signal.h:63
@ SI_TIMER
Signal was generated by expiration of a timer set by timer_settimer().
Definition: signal.h:64
@ FPE_FLTDIV
Floating point divide-by-zero.
Definition: signal.h:83
@ SI_USER
Signal sent by kill(), pthread_kill(), raise(), abort() or alarm().
Definition: signal.h:55
@ FPE_FLTOVF
Floating point overflow.
Definition: signal.h:84
@ ILL_COPROC
Coprocessor error.
Definition: signal.h:76
@ SI_KERNEL
Generic kernel function.
Definition: signal.h:59
@ CLD_CONTINUED
Stopped child has continued.
Definition: signal.h:115
@ ILL_PRVREG
Privileged register.
Definition: signal.h:75
@ FPE_FLTUND
Floating point underflow.
Definition: signal.h:85
@ POLL_ERR
I/O error.
Definition: signal.h:122
@ ILL_ILLOPN
Illegal operand.
Definition: signal.h:71
@ POLL_MSG
Input message available.
Definition: signal.h:121
@ POLL_HUP
Device disconnected.
Definition: signal.h:124
@ ILL_BADSTK
Internal stack error.
Definition: signal.h:77
struct sigaction_t sigaction_t
Holds the information on how to handle a specific signal.
union sigval sigval_t
Data passed with signal info.
int sigismember(sigset_t *set, int signum)
Checks if the given signal is part of the set.
Definition: signal.c:912
int sigemptyset(sigset_t *set)
Prepare an empty set.
Definition: signal.c:876
int sys_kill(pid_t pid, int sig)
Send signal to one specific process.
Definition: signal.c:704
int sys_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
Examine and change blocked signals.
Definition: signal.c:808
struct sighand_t sighand_t
Describes how each signal must be handled.
void(* sighandler_t)(int)
Type of a signal handler.
Definition: signal.h:154
int sigfillset(sigset_t *set)
Prepare a full set.
Definition: signal.c:885
struct sigset_t sigset_t
Structure used to mask and unmask signals.
int sys_sigpending(sigset_t *set)
Provides a snapshot of pending signals.
Definition: signal.c:853
struct sigqueue_t sigqueue_t
An entry of the signal queue.
int signals_init(void)
Initialize the signals.
Definition: signal.c:596
int sigdelset(sigset_t *set, int signum)
Removes the given signal to the correct set.
Definition: signal.c:903
struct sigpending_t sigpending_t
Keeps information of pending signals.
int do_signal(struct pt_regs *f)
Handles the signals of the current process.
Definition: signal.c:449
sighandler_t sys_signal(int signum, sighandler_t handler, uint32_t sigreturn_addr)
Sets the disposition of the signal signum to handler.
Definition: signal.c:729
sigmask_how_t
Defines what to do with the provided signal mask.
Definition: signal.h:128
@ SIG_BLOCK
The set of blocked signals is the union of the current set and the set argument.
Definition: signal.h:131
@ SIG_UNBLOCK
The signals in set are removed from the current set of blocked signals. It is permissible to attempt ...
Definition: signal.h:135
@ SIG_SETMASK
The set of blocked signals is set to the argument set.
Definition: signal.h:137
int sigaddset(sigset_t *set, int signum)
Adds the given signal to the correct set.
Definition: signal.c:894
struct siginfo_t siginfo_t
Stores information about an occurrence of a specific signal.
long sys_sigreturn(struct pt_regs *f)
Handle the return from a signal handler.
Definition: signal.c:373
const char * strsignal(int sig)
Returns the string describing the given signal.
Definition: signal.c:868
atomic_t spinlock_t
Spinlock structure.
Definition: spinlock.h:16
volatile unsigned atomic_t
Standard structure for atomic operations (see below for volatile explanation).
Definition: stdatomic.h:12
int uid_t
The type of user-id.
Definition: stddef.h:40
unsigned int uint32_t
Define the unsigned 32-bit integer.
Definition: stdint.h:18
Interrupt stack frame.
Definition: kernel.h:24
Holds the information on how to handle a specific signal.
Definition: signal.h:173
unsigned int sa_flags
This set of flags specifies how the signal must be handled;.
Definition: signal.h:182
sigset_t sa_mask
This sigset_t variable specifies the signals to be masked when running the signal handler.
Definition: signal.h:180
sighandler_t sa_handler
Definition: signal.h:178
Describes how each signal must be handled.
Definition: signal.h:186
sigaction_t action[NSIG]
Array of structures specifying the actions to be performed upon delivering the signals.
Definition: signal.h:190
atomic_t count
Usage counter of the signal handler descriptor.
Definition: signal.h:188
spinlock_t siglock
Spinlock protecting both the signal descriptor and the signal handler descriptor.
Definition: signal.h:192
Stores information about an occurrence of a specific signal.
Definition: signal.h:202
int si_code
A code identifying who raised the signal (see signal_sender_code_t).
Definition: signal.h:206
uid_t si_uid
Real user ID of sending process.
Definition: signal.h:214
int si_signo
The signal number.
Definition: signal.h:204
pid_t si_pid
Process ID of sending process.
Definition: signal.h:212
sigval_t si_value
Signal value.
Definition: signal.h:208
int si_status
Exit value or signal for process termination.
Definition: signal.h:218
void * si_addr
Address at which fault occurred.
Definition: signal.h:216
int si_band
Band event for SIGPOLL/SIGIO.
Definition: signal.h:220
int si_errno
The error code of the instruction that caused the signal to be raised, or 0 if there was no error.
Definition: signal.h:210
Keeps information of pending signals.
Definition: signal.h:236
sigset_t signal
The mask which can be queried to know which signals are pending.
Definition: signal.h:240
list_head list
Head of the list of pending signals.
Definition: signal.h:238
An entry of the signal queue.
Definition: signal.h:224
int flags
Flags associated with the queued signal.
Definition: signal.h:228
siginfo_t info
Describes the event that raised the signal.
Definition: signal.h:230
list_head list
Links for the pending signal queue’s list.
Definition: signal.h:226
Structure used to mask and unmask signals.
Definition: signal.h:167
unsigned long sig[2]
Signals divided into two cathegories.
Definition: signal.h:169
System Call handler definition.
Data passed with signal info.
Definition: signal.h:196
int sival_int
Integer value.
Definition: signal.h:197
void * sival_ptr
Pointer value.
Definition: signal.h:198