#include <sys/signal.h>

sys/signal.h

includes: sys/cdefs.h, sys/appleapiopts.h, Availability.h, machine/signal.h, sys/_types.h, machine/_mcontext.h, sys/_pthread/_pthread_attr_t.h, sys/_types/_sigaltstack.h, sys/_types/_ucontext.h, sys/_types/_pid_t.h, sys/_types/_sigset_t.h, sys/_types/_size_t.h, sys/_types/_uid_t.h
114 macros · 6 structs · 2 unions · 2 typedefs · 1 function

macroNSIG

#define NSIG __DARWIN_NSIG

macroSIGHUP

#define SIGHUP 1
hangup

macroSIGINT

#define SIGINT 2
interrupt

macroSIGQUIT

#define SIGQUIT 3
quit

macroSIGILL

#define SIGILL 4
illegal instruction (not reset when caught)

macroSIGTRAP

#define SIGTRAP 5
trace trap (not reset when caught)

macroSIGABRT

#define SIGABRT 6
abort()

macroSIGIOT

#define SIGIOT SIGABRT
compatibility

macroSIGEMT

#define SIGEMT 7
EMT instruction

macroSIGFPE

#define SIGFPE 8
floating point exception

macroSIGKILL

#define SIGKILL 9
kill (cannot be caught or ignored)

macroSIGBUS

#define SIGBUS 10
bus error

macroSIGSEGV

#define SIGSEGV 11
segmentation violation

macroSIGSYS

#define SIGSYS 12
bad argument to system call

macroSIGPIPE

#define SIGPIPE 13
write on a pipe with no one to read it

macroSIGALRM

#define SIGALRM 14
alarm clock

macroSIGTERM

#define SIGTERM 15
software termination signal from kill

macroSIGURG

#define SIGURG 16
urgent condition on IO channel

macroSIGSTOP

#define SIGSTOP 17
sendable stop signal not from tty

macroSIGTSTP

#define SIGTSTP 18
stop signal from tty

macroSIGCONT

#define SIGCONT 19
continue a stopped process

macroSIGCHLD

#define SIGCHLD 20
to parent on child stop or exit

macroSIGTTIN

#define SIGTTIN 21
to readers pgrp upon background tty read

macroSIGTTOU

#define SIGTTOU 22
like TTIN for output if (tp->t_local&LTOSTOP)

macroSIGIO

#define SIGIO 23
input/output possible signal

macroSIGXCPU

#define SIGXCPU 24
exceeded CPU time limit

macroSIGXFSZ

#define SIGXFSZ 25
exceeded file size limit

macroSIGVTALRM

#define SIGVTALRM 26
virtual time alarm

macroSIGPROF

#define SIGPROF 27
profiling time alarm

macroSIGWINCH

#define SIGWINCH 28
window size changes

macroSIGINFO

#define SIGINFO 29
information request

macroSIGUSR1

#define SIGUSR1 30
user defined signal 1

macroSIGUSR2

#define SIGUSR2 31
user defined signal 2

macroSIG_DFL

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

macroSIG_IGN

#define SIG_IGN (void (*)(int))1

macroSIG_HOLD

#define SIG_HOLD (void (*)(int))5

macroSIG_ERR

#define SIG_ERR ((void (*)(int))-1)

unionsigval

size 8, align 8
intsival_intMembers as suggested by Annex C of POSIX 1003.1b.
void *sival_ptr

macroSIGEV_NONE

#define SIGEV_NONE 0
No async notification

macroSIGEV_SIGNAL

#define SIGEV_SIGNAL 1
aio - completion notification

macroSIGEV_THREAD

#define SIGEV_THREAD 3
[NOTIMP] [RTS] call notification function

macroSIGEV_KEVENT

#define SIGEV_KEVENT 4
Generate a kevent

structsigevent

size 32, align 8
intsigev_notifyNotification type
intsigev_signoSignal number
union sigvalsigev_valueSignal value
void (*)(union sigval)sigev_notify_functionNotification function
pthread_attr_t *sigev_notify_attributesNotification attributes

struct__siginfo

size 104, align 8
intsi_signosignal number
intsi_errnoerrno association
intsi_codesignal code
pid_tsi_pidsending process
uid_tsi_uidsender's ruid
intsi_statusexit value
void *si_addrfaulting instruction
union sigvalsi_valuesignal value
longsi_bandband event for SIGPOLL
unsigned long[7]__padReserved for Future Use

typedefsiginfo_t

typedef struct __siginfo siginfo_t;

macroILL_NOOP

Codes for SIGILL
#define ILL_NOOP 0
if only I knew...

macroILL_ILLOPC

#define ILL_ILLOPC 1
[XSI] illegal opcode

macroILL_ILLTRP

#define ILL_ILLTRP 2
[XSI] illegal trap

macroILL_PRVOPC

#define ILL_PRVOPC 3
[XSI] privileged opcode

macroILL_ILLOPN

#define ILL_ILLOPN 4
[XSI] illegal operand -NOTIMP

macroILL_ILLADR

#define ILL_ILLADR 5
[XSI] illegal addressing mode -NOTIMP

macroILL_PRVREG

#define ILL_PRVREG 6
[XSI] privileged register -NOTIMP

macroILL_COPROC

#define ILL_COPROC 7
[XSI] coprocessor error -NOTIMP

macroILL_BADSTK

#define ILL_BADSTK 8
[XSI] internal stack error -NOTIMP

macroFPE_NOOP

Codes for SIGFPE
#define FPE_NOOP 0
if only I knew...

macroFPE_FLTDIV

#define FPE_FLTDIV 1
[XSI] floating point divide by zero

macroFPE_FLTOVF

#define FPE_FLTOVF 2
[XSI] floating point overflow

macroFPE_FLTUND

#define FPE_FLTUND 3
[XSI] floating point underflow

macroFPE_FLTRES

#define FPE_FLTRES 4
[XSI] floating point inexact result

macroFPE_FLTINV

#define FPE_FLTINV 5
[XSI] invalid floating point operation

macroFPE_FLTSUB

#define FPE_FLTSUB 6
[XSI] subscript out of range -NOTIMP

macroFPE_INTDIV

#define FPE_INTDIV 7
[XSI] integer divide by zero

macroFPE_INTOVF

#define FPE_INTOVF 8
[XSI] integer overflow

macroSEGV_NOOP

Codes for SIGSEGV
#define SEGV_NOOP 0
if only I knew...

macroSEGV_MAPERR

#define SEGV_MAPERR 1
[XSI] address not mapped to object

macroSEGV_ACCERR

#define SEGV_ACCERR 2
[XSI] invalid permission for mapped object

macroBUS_NOOP

Codes for SIGBUS
#define BUS_NOOP 0
if only I knew...

macroBUS_ADRALN

#define BUS_ADRALN 1
[XSI] Invalid address alignment

macroBUS_ADRERR

#define BUS_ADRERR 2
[XSI] Nonexistent physical address -NOTIMP

macroBUS_OBJERR

#define BUS_OBJERR 3
[XSI] Object-specific HW error - NOTIMP

macroTRAP_BRKPT

Codes for SIGTRAP
#define TRAP_BRKPT 1
[XSI] Process breakpoint -NOTIMP

macroTRAP_TRACE

#define TRAP_TRACE 2
[XSI] Process trace trap -NOTIMP

macroCLD_NOOP

Codes for SIGCHLD
#define CLD_NOOP 0
if only I knew...

macroCLD_EXITED

#define CLD_EXITED 1
[XSI] child has exited

macroCLD_KILLED

#define CLD_KILLED 2
[XSI] terminated abnormally, no core file

macroCLD_DUMPED

#define CLD_DUMPED 3
[XSI] terminated abnormally, core file

macroCLD_TRAPPED

#define CLD_TRAPPED 4
[XSI] traced child has trapped

macroCLD_STOPPED

#define CLD_STOPPED 5
[XSI] child has stopped

macroCLD_CONTINUED

#define CLD_CONTINUED 6
[XSI] stopped child has continued

macroPOLL_IN

Codes for SIGPOLL
#define POLL_IN 1
[XSR] Data input available

macroPOLL_OUT

#define POLL_OUT 2
[XSR] Output buffers available

macroPOLL_MSG

#define POLL_MSG 3
[XSR] Input message available

macroPOLL_ERR

#define POLL_ERR 4
[XSR] I/O error

macroPOLL_PRI

#define POLL_PRI 5
[XSR] High priority input available

macroPOLL_HUP

#define POLL_HUP 6
[XSR] Device disconnected

union__sigaction_u

union for signal handlers
size 8, align 8
void (*)(int)__sa_handler
void (*)(int, struct __siginfo *, void *)__sa_sigaction

struct__sigaction

Signal vector template for Kernel user boundary
size 24, align 8
union __sigaction_u__sigaction_usignal handler
void (*)(void *, int, int, siginfo_t *, void *)sa_tramp
sigset_tsa_masksignal mask to apply
intsa_flagssee signal options below

structsigaction

Signal vector "template" used in sigaction call.
size 16, align 8
union __sigaction_u__sigaction_usignal handler
sigset_tsa_masksignal mask to apply
intsa_flagssee signal options below

macrosa_handler

if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler.
#define sa_handler __sigaction_u.__sa_handler

macrosa_sigaction

#define sa_sigaction __sigaction_u.__sa_sigaction

macroSA_ONSTACK

#define SA_ONSTACK 0x0001
take signal on signal stack

macroSA_RESTART

#define SA_RESTART 0x0002
restart system on signal return

macroSA_RESETHAND

#define SA_RESETHAND 0x0004
reset to SIG_DFL when taking signal

macroSA_NOCLDSTOP

#define SA_NOCLDSTOP 0x0008
do not generate SIGCHLD on child stop

macroSA_NODEFER

#define SA_NODEFER 0x0010
don't mask the signal we're delivering

macroSA_NOCLDWAIT

#define SA_NOCLDWAIT 0x0020
don't keep zombies around

macroSA_SIGINFO

#define SA_SIGINFO 0x0040
signal handler with SA_SIGINFO args

macroSA_USERTRAMP

#define SA_USERTRAMP 0x0100
do not bounce off kernel's sigtramp

macroSA_64REGSET

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

macroSA_USERSPACE_MASK

the following are the only bits we support from user space, the rest are for kernel use only.
#define SA_USERSPACE_MASK (SA_ONSTACK | SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT | SA_SIGINFO)

macroSIG_BLOCK

Flags for sigprocmask:
#define SIG_BLOCK 1
block specified signal set

macroSIG_UNBLOCK

#define SIG_UNBLOCK 2
unblock specified signal set

macroSIG_SETMASK

#define SIG_SETMASK 3
set specified signal set

macroSI_USER

POSIX 1003.1b required values.
#define SI_USER 0x10001
[CX] signal from kill()

macroSI_QUEUE

#define SI_QUEUE 0x10002
[CX] signal from sigqueue()

macroSI_TIMER

#define SI_TIMER 0x10003
[CX] timer expiration

macroSI_ASYNCIO

#define SI_ASYNCIO 0x10004
[CX] aio request completion

macroSI_MESGQ

#define SI_MESGQ 0x10005
[CX] from message arrival on empty queue

typedefsig_t

typedef void (*sig_t)(int)
type of signal function

macroSS_ONSTACK

#define SS_ONSTACK 0x0001
take signal on signal stack

macroSS_DISABLE

#define SS_DISABLE 0x0004
disable taking signals on alternate stack

macroMINSIGSTKSZ

#define MINSIGSTKSZ 32768
(32K)minimum allowable stack

macroSIGSTKSZ

#define SIGSTKSZ 131072
(128K)recommended stack size

structsigvec

4.3 compatibility: Signal vector "template" used in sigvec call.
size 16, align 8
void (*)(int)sv_handlersignal handler
intsv_masksignal mask to apply
intsv_flagssee signal options below

macroSV_ONSTACK

#define SV_ONSTACK SA_ONSTACK

macroSV_INTERRUPT

#define SV_INTERRUPT SA_RESTART
same bit, opposite sense

macroSV_RESETHAND

#define SV_RESETHAND SA_RESETHAND

macroSV_NODEFER

#define SV_NODEFER SA_NODEFER

macroSV_NOCLDSTOP

#define SV_NOCLDSTOP SA_NOCLDSTOP

macroSV_SIGINFO

#define SV_SIGINFO SA_SIGINFO

macrosv_onstack

#define sv_onstack sv_flags
isn't compatibility wonderful!

structsigstack

Structure used in sigstack call.
size 16, align 8
char *ss_spsignal stack pointer
intss_onstackcurrent status

macrosigmask

Macro for converting signal number to a mask suitable for sigblock().
#define sigmask(m) (1 << ((m)-1))

macroBADSIG

#define BADSIG SIG_ERR

functionsignal

)(int)
void(*signal(int, void (*)(int))
man page · June 7, 2004
signal(3) — simplified software signal facilities