#include <sys/signal.h>
sys/signal.h
114 macros · 6 structs · 2 unions · 2 typedefs · 1 function
#define NSIG __DARWIN_NSIG
#define SIGINT 2
interrupt
#define SIGILL 4
illegal instruction (not reset when caught)
#define SIGTRAP 5
trace trap (not reset when caught)
#define SIGIOT SIGABRT
compatibility
#define SIGEMT 7
EMT instruction
#define SIGFPE 8
floating point exception
#define SIGKILL 9
kill (cannot be caught or ignored)
#define SIGBUS 10
bus error
#define SIGSEGV 11
segmentation violation
#define SIGSYS 12
bad argument to system call
#define SIGPIPE 13
write on a pipe with no one to read it
#define SIGALRM 14
alarm clock
#define SIGTERM 15
software termination signal from kill
#define SIGURG 16
urgent condition on IO channel
#define SIGSTOP 17
sendable stop signal not from tty
#define SIGTSTP 18
stop signal from tty
#define SIGCONT 19
continue a stopped process
#define SIGCHLD 20
to parent on child stop or exit
#define SIGTTIN 21
to readers pgrp upon background tty read
#define SIGTTOU 22
like TTIN for output if (tp->t_local&
LTOSTOP)
#define SIGIO 23
input/output possible signal
#define SIGXCPU 24
exceeded CPU time limit
#define SIGXFSZ 25
exceeded file size limit
#define SIGVTALRM 26
virtual time alarm
#define SIGPROF 27
profiling time alarm
#define SIGWINCH 28
window size changes
#define SIGINFO 29
information request
#define SIGUSR1 30
user defined signal 1
#define SIGUSR2 31
user defined signal 2
Language spec sez we must list exactly one parameter, even though we
actually supply three. Ugh!
SIG_HOLD is chosen to avoid KERN_SIG_* values in <sys/signalvar.h>
#define SIG_DFL (void (*)(int))0
#define SIG_IGN (void (*)(int))1
#define SIG_HOLD (void (*)(int))5
#define SIG_ERR ((void (*)(int))-1)
size 8, align 8
| int | sival_int | Members as suggested by Annex C of POSIX 1003.1b. |
| void * | sival_ptr | |
#define SIGEV_NONE 0
No async notification
#define SIGEV_SIGNAL 1
aio - completion notification
#define SIGEV_THREAD 3
[
NOTIMP] [RTS] call notification function
#define SIGEV_KEVENT 4
Generate a kevent
size 32, align 8
| int | sigev_notify | Notification type |
| int | sigev_signo | Signal number |
| union sigval | sigev_value | Signal value |
| void (*)(union sigval) | sigev_notify_function | Notification function |
| pthread_attr_t * | sigev_notify_attributes | Notification attributes |
size 104, align 8
| int | si_signo | signal number |
| int | si_errno | errno association |
| int | si_code | signal code |
| pid_t | si_pid | sending process |
| uid_t | si_uid | sender's ruid |
| int | si_status | exit value |
| void * | si_addr | faulting instruction |
| union sigval | si_value | signal value |
| long | si_band | band event for SIGPOLL |
| unsigned long[7] | __pad | Reserved for Future Use |
#define ILL_NOOP 0
if only I knew...
#define ILL_ILLOPC 1
[XSI] illegal opcode
#define ILL_ILLTRP 2
[XSI] illegal trap
#define ILL_PRVOPC 3
[XSI] privileged opcode
#define ILL_ILLADR 5
[XSI] illegal addressing mode -
NOTIMP#define ILL_PRVREG 6
[XSI] privileged register -
NOTIMP#define ILL_COPROC 7
[XSI] coprocessor error -
NOTIMP#define ILL_BADSTK 8
[XSI] internal stack error -
NOTIMP#define FPE_NOOP 0
if only I knew...
#define FPE_FLTDIV 1
[XSI] floating point divide by zero
#define FPE_FLTOVF 2
[XSI] floating point overflow
#define FPE_FLTUND 3
[XSI] floating point underflow
#define FPE_FLTRES 4
[XSI] floating point inexact result
#define FPE_FLTINV 5
[XSI] invalid floating point operation
#define FPE_FLTSUB 6
[XSI] subscript out of range -
NOTIMP#define FPE_INTDIV 7
[XSI] integer divide by zero
#define FPE_INTOVF 8
[XSI] integer overflow
#define SEGV_NOOP 0
if only I knew...
#define SEGV_MAPERR 1
[XSI] address not mapped to object
#define SEGV_ACCERR 2
[XSI] invalid permission for mapped object
#define BUS_NOOP 0
if only I knew...
#define BUS_ADRALN 1
[XSI] Invalid address alignment
#define BUS_ADRERR 2
[XSI] Nonexistent physical address -
NOTIMP#define BUS_OBJERR 3
[XSI] Object-specific HW error -
NOTIMP#define TRAP_BRKPT 1
[XSI] Process breakpoint -
NOTIMP#define TRAP_TRACE 2
[XSI] Process trace trap -
NOTIMP#define CLD_NOOP 0
if only I knew...
#define CLD_EXITED 1
[XSI] child has exited
#define CLD_KILLED 2
[XSI] terminated abnormally, no core file
#define CLD_DUMPED 3
[XSI] terminated abnormally, core file
#define CLD_TRAPPED 4
[XSI] traced child has trapped
#define CLD_STOPPED 5
[XSI] child has stopped
#define CLD_CONTINUED 6
[XSI] stopped child has continued
Codes for SIGPOLL
#define POLL_IN 1
[XSR] Data input available
#define POLL_OUT 2
[XSR] Output buffers available
#define POLL_MSG 3
[XSR] Input message available
#define POLL_ERR 4
[XSR] I/O error
#define POLL_PRI 5
[XSR] High priority input available
#define POLL_HUP 6
[XSR] Device disconnected
union for signal handlers
size 8, align 8
| void (*)(int) | __sa_handler | |
| void (*)(int, struct __siginfo *, void *) | __sa_sigaction | |
Signal vector template for Kernel user boundary
size 24, align 8
| union __sigaction_u | __sigaction_u | signal handler |
| void (*)(void *, int, int, siginfo_t *, void *) | sa_tramp | |
| sigset_t | sa_mask | signal mask to apply |
| int | sa_flags | see signal options below |
Signal vector "template" used in sigaction call.
size 16, align 8
| union __sigaction_u | __sigaction_u | signal handler |
| sigset_t | sa_mask | signal mask to apply |
| int | sa_flags | see signal options below |
#define SA_ONSTACK 0x0001
take signal on signal stack
#define SA_RESTART 0x0002
restart system on signal return
#define SA_RESETHAND 0x0004
reset to
SIG_DFL when taking signal
#define SA_NOCLDSTOP 0x0008
do not generate
SIGCHLD on child stop
#define SA_NODEFER 0x0010
don't mask the signal we're delivering
#define SA_NOCLDWAIT 0x0020
don't keep zombies around
#define SA_SIGINFO 0x0040
signal handler with SA_SIGINFO args
#define SA_USERTRAMP 0x0100
do not bounce off kernel's sigtramp
This will provide 64bit register set in a 32bit user address space
#define SA_64REGSET 0x0200
signal handler with
SA_SIGINFO args with 64bit regs information
Flags for sigprocmask:
#define SIG_BLOCK 1
block specified signal set
#define SIG_UNBLOCK 2
unblock specified signal set
#define SIG_SETMASK 3
set specified signal set
POSIX 1003.1b required values.
#define SI_USER 0x10001
[CX] signal from kill()
#define SI_QUEUE 0x10002
[CX] signal from sigqueue()
#define SI_TIMER 0x10003
[CX] timer expiration
#define SI_ASYNCIO 0x10004
[CX] aio request completion
#define SI_MESGQ 0x10005
[CX] from message arrival on empty queue
typedef void (*sig_t)(int)
type of signal function
#define SS_ONSTACK 0x0001
take signal on signal stack
#define SS_DISABLE 0x0004
disable taking signals on alternate stack
#define MINSIGSTKSZ 32768
(32K)minimum allowable stack
#define SIGSTKSZ 131072
(128K)recommended stack size
4.3 compatibility:
Signal vector "template" used in sigvec call.
size 16, align 8
| void (*)(int) | sv_handler | signal handler |
| int | sv_mask | signal mask to apply |
| int | sv_flags | see signal options below |
#define SV_INTERRUPT SA_RESTART
same bit, opposite sense
#define sv_onstack sv_flags
isn't compatibility wonderful!
Structure used in sigstack call.
size 16, align 8
| char * | ss_sp | signal stack pointer |
| int | ss_onstack | current status |
Macro for converting signal number to a mask suitable for
sigblock().
#define sigmask(m) (1 << ((m)-1))
)(int)
void(*signal(int, void (*)(int))
man page · June 7, 2004
signal(3) — simplified software signal facilities