---
name: "signal.h"
section: "0p"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/signal.h"
---

# signal.h(0p)

signals

## PROLOG

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

## NAME

signal.h — signals

## SYNOPSIS

```
#include <signal.h>
```

## DESCRIPTION

Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see the System Interfaces volume of POSIX.1‐2017, *Section 2.2*, *The Compilation Environment*) to enable the visibility of these symbols in this header.

The *\<signal.h\>* header shall define the following macros, which shall expand to constant expressions with distinct values that have a type compatible with the second argument to, and the return value of, the *signal*() function, and whose values shall compare unequal to the address of any declarable function.

- SIG\_DFL

  Request for default signal handling.

- SIG\_ERR

  Return value from *signal*() in case of error.

- SIG\_HOLD

  Request that signal be held.

- SIG\_IGN

  Request that signal be ignored.

The *\<signal.h\>* header shall define the **pthread\_t**, **size\_t**, and **uid\_t** types as described in *\<sys/types.h\>*.

The *\<signal.h\>* header shall define the **timespec** structure as described in *\<time.h\>*.

The *\<signal.h\>* header shall define the following data types:

- **sig\_atomic\_t**

  Possibly volatile-qualified integer type of an object that can be accessed as an atomic entity, even in the presence of asynchronous interrupts.

- **sigset\_t**

  Integer or structure type of an object used to represent sets of signals.

- **pid\_t**

  As described in *\<sys/types.h\>*.

The *\<signal.h\>* header shall define the **pthread\_attr\_t** type as described in *\<sys/types.h\>*.

The *\<signal.h\>* header shall define the **sigevent** structure, which shall include at least the following members:

```
int              sigev_notify            Notification type.
int              sigev_signo             Signal number.
union sigval     sigev_value             Signal value.
void           (*sigev_notify_function)(union sigval)
                                         Notification function.
pthread_attr_t *sigev_notify_attributes  Notification attributes.
```

The *\<signal.h\>* header shall define the following symbolic constants for the values of *sigev\_notify*:

- SIGEV\_NONE

  No asynchronous notification is delivered when the event of interest occurs.

- SIGEV\_SIGNAL

  A queued signal, with an application-defined value, is generated when the event of interest occurs.

- SIGEV\_THREAD

  A notification function is called to perform notification.\

The **sigval** union shall be defined as:

```
int    sival_int    Integer signal value.
void  *sival_ptr    Pointer signal value.
```

The *\<signal.h\>* header shall declare the SIGRTMIN and SIGRTMAX macros, which shall expand to positive integer expressions with type **int**, but which need not be constant expressions. These macros specify a range of signal numbers that are reserved for application use and for which the realtime signal behavior specified in this volume of POSIX.1‐2017 is supported. The signal numbers in this range do not overlap any of the signals specified in the following table.

The range SIGRTMIN through SIGRTMAX inclusive shall include at least {RTSIG\_MAX} signal numbers.

It is implementation-defined whether realtime signal behavior is supported for other signals.

The *\<signal.h\>* header shall define the following macros that are used to refer to the signals that occur in the system. Signals defined here begin with the letters SIG followed by an uppercase letter. The macros shall expand to positive integer constant expressions with type **int** and distinct values. The value 0 is reserved for use as the null signal (see *kill*()). Additional implementation-defined signals may occur in the system.

The ISO C standard only requires the signal names SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, and SIGTERM to be defined. An implementation need not generate any of these six signals, except as a result of explicit use of interfaces that generate signals, such as *raise*(), *kill*(), the General Terminal Interface (see *Section 11.1.9*, *Special Characters*), and the *kill* utility, unless otherwise stated (see, for example, the System Interfaces volume of POSIX.1‐2017, *Section 2.8.3.3*, *Memory Protection*).

The following signals shall be supported on all implementations (default actions are explained below the table):

| | | |
| --- | --- | --- |
| **Signal** | **Default Action** | **Description** |
| SIGABRT | A | Process abort signal. |
| SIGALRM | T | Alarm clock. |
| SIGBUS | A | Access to an undefined portion of a memory object. |
| SIGCHLD | I | Child process terminated, stopped, |
|  |  | or continued. |
| SIGCONT | C | Continue executing, if stopped. |
| SIGFPE | A | Erroneous arithmetic operation. |
| SIGHUP | T | Hangup. |
| SIGILL | A | Illegal instruction. |
| SIGINT | T | Terminal interrupt signal. |
| SIGKILL | T | Kill (cannot be caught or ignored). |
| SIGPIPE | T | Write on a pipe with no one to read it. |
| SIGQUIT | A | Terminal quit signal. |
| SIGSEGV | A | Invalid memory reference. |
| SIGSTOP | S | Stop executing (cannot be caught or ignored). |
| SIGTERM | T | Termination signal. |
| SIGTSTP | S | Terminal stop signal. |
| SIGTTIN | S | Background process attempting read. |
| SIGTTOU | S | Background process attempting write. |
| SIGUSR1 | T | User-defined signal 1. |
| SIGUSR2 | T | User-defined signal 2. |
| SIGPOLL | T | Pollable event. |
| SIGPROF | T | Profiling timer expired. |
| SIGSYS | A | Bad system call. |
| SIGTRAP | A | Trace/breakpoint trap. |
| SIGURG | I | High bandwidth data is available at a socket. |
| SIGVTALRM | T | Virtual timer expired. |
| SIGXCPU | A | CPU time limit exceeded. |
| SIGXFSZ | A | File size limit exceeded. |

The default actions are as follows:

- T

  Abnormal termination of the process.

- A

  Abnormal termination of the process with additional actions.

- I

  Ignore the signal.

- S

  Stop the process.

- C

  Continue the process, if it is stopped; otherwise, ignore the signal.

The effects on the process in each case are described in the System Interfaces volume of POSIX.1‐2017, *Section 2.4.3*, *Signal Actions*.

The *\<signal.h\>* header shall declare the **sigaction** structure, which shall include at least the following members:

```
void   (*sa_handler)(int)  Pointer to a signal-catching function
                           or one of the SIG_IGN or SIG_DFL.
sigset_t sa_mask           Set of signals to be blocked during execution
                           of the signal handling function.
int      sa_flags          Special flags.
void   (*sa_sigaction)(int, siginfo_t *, void *)
                           Pointer to a signal-catching function.
```

The storage occupied by *sa\_handler* and *sa\_sigaction* may overlap, and a conforming application shall not use both simultaneously.

The *\<signal.h\>* header shall define the following macros which shall expand to integer constant expressions that need not be usable in **#if** preprocessing directives:

- SIG\_BLOCK

  The resulting set is the union of the current set and the signal set pointed to by the argument *set*.

- SIG\_UNBLOCK

  The resulting set is the intersection of the current set and the complement of the signal set pointed to by the argument *set*.

- SIG\_SETMASK

  The resulting set is the signal set pointed to by the argument *set*.

The *\<signal.h\>* header shall also define the following symbolic constants:

- SA\_NOCLDSTOP

  Do not generate SIGCHLD when children stop\
   or stopped children continue.

- SA\_ONSTACK

  Causes signal delivery to occur on an alternate stack.

- SA\_RESETHAND

  Causes signal dispositions to be set to SIG\_DFL on entry to signal handlers.

- SA\_RESTART

  Causes certain functions to become restartable.

- SA\_SIGINFO

  Causes extra information to be passed to signal handlers at the time of receipt of a signal.

- SA\_NOCLDWAIT

  Causes implementations not to create zombie processes or status information on child termination. See *sigaction()*.

- SA\_NODEFER

  Causes signal not to be automatically blocked on entry to signal handler.

- SS\_ONSTACK

  Process is executing on an alternate signal stack.

- SS\_DISABLE

  Alternate signal stack is disabled.

- MINSIGSTKSZ

  Minimum stack size for a signal handler.

- SIGSTKSZ

  Default size in bytes for the alternate signal stack.

The *\<signal.h\>* header shall define the **mcontext\_t** type through **typedef**.

The *\<signal.h\>* header shall define the **ucontext\_t** type as a structure that shall include at least the following members:

```
ucontext_t *uc_link     Pointer to the context that is resumed
                        when this context returns.
sigset_t    uc_sigmask  The set of signals that are blocked when this
                        context is active.
stack_t     uc_stack    The stack used by this context.
mcontext_t  uc_mcontext A machine-specific representation of the saved
                        context.
```

The *\<signal.h\>* header shall define the **stack\_t** type as a structure, which shall include at least the following members:

```
void     *ss_sp       Stack base or pointer.
size_t    ss_size     Stack size.
int       ss_flags    Flags.
```

The *\<signal.h\>* header shall define the **siginfo\_t** type as a structure, which shall include at least the following members:

```
int           si_signo  Signal number.
int           si_code   Signal code.
int           si_errno  If non-zero, an errno value associated with
                        this signal, as described in <errno.h>.
pid_t         si_pid    Sending process ID.
uid_t         si_uid    Real user ID of sending process.
void         *si_addr   Address of faulting instruction.
int           si_status Exit value or signal.
long          si_band   Band event for SIGPOLL.
union sigval  si_value  Signal value.
```

The *\<signal.h\>* header shall define the symbolic constants in the **Code** column of the following table for use as values of *si\_code* that are signal-specific or non-signal-specific reasons why the signal was generated.

| | | |
| --- | --- | --- |
| **Signal** | **Code** | **Reason** |
| SIGILL | ILL\_ILLOPC | Illegal opcode. |
|  | ILL\_ILLOPN | Illegal operand. |
|  | ILL\_ILLADR | Illegal addressing mode. |
|  | ILL\_ILLTRP | Illegal trap. |
|  | ILL\_PRVOPC | Privileged opcode. |
|  | ILL\_PRVREG | Privileged register. |
|  | ILL\_COPROC | Coprocessor error. |
|  | ILL\_BADSTK | Internal stack error. |
| SIGFPE | FPE\_INTDIV | Integer divide by zero. |
|  | FPE\_INTOVF | Integer overflow. |
|  | FPE\_FLTDIV | Floating-point divide by zero. |
|  | FPE\_FLTOVF | Floating-point overflow. |
|  | FPE\_FLTUND | Floating-point underflow. |
|  | FPE\_FLTRES | Floating-point inexact result. |
|  | FPE\_FLTINV | Invalid floating-point operation. |
|  | FPE\_FLTSUB | Subscript out of range. |
| SIGSEGV | SEGV\_MAPERR | Address not mapped to object. |
|  | SEGV\_ACCERR | Invalid permissions for mapped object. |
| SIGBUS | BUS\_ADRALN | Invalid address alignment. |
|  | BUS\_ADRERR | Nonexistent physical address. |
|  | BUS\_OBJERR | Object-specific hardware error. |
| SIGTRAP | TRAP\_BRKPT | Process breakpoint. |
|  | TRAP\_TRACE | Process trace trap. |
| SIGCHLD | CLD\_EXITED | Child has exited. |
|  | CLD\_KILLED | Child has terminated abnormally and did not create a **core** file. |
|  | CLD\_DUMPED | Child has terminated abnormally and created a **core** file. |
|  | CLD\_TRAPPED | Traced child has trapped. |
|  | CLD\_STOPPED | Child has stopped. |
|  | CLD\_CONTINUED | Stopped child has continued. |
| SIGPOLL | POLL\_IN | Data input available. |
|  | POLL\_OUT | Output buffers available. |
|  | POLL\_MSG | Input message available. |
|  | POLL\_ERR | I/O error. |
|  | POLL\_PRI | High priority input available. |
|  | POLL\_HUP | Device disconnected. |
| Any | SI\_USER | Signal sent by *kill*(). |
|  | SI\_QUEUE | Signal sent by *sigqueue*(). |
|  | SI\_TIMER | Signal generated by expiration of a timer set by *timer\_settime*(). |
|  | SI\_ASYNCIO | Signal generated by completion of an asynchronous I/O |
|  |  | request. |
|  | SI\_MESGQ | Signal generated by arrival of a message on an empty message |
|  |  | queue. |

Implementations may support additional *si\_code* values not included in this list, may generate values included in this list under circumstances other than those described in this list, and may contain extensions or limitations that prevent some values from being generated. Implementations do not generate a different value from the ones described in this list for circumstances described in this list.\

In addition, the following signal-specific information shall be available:

| | | |
| --- | --- | --- |
| **Signal** | **Member** | **Value** |
| SIGILL | **void \* *si\_addr*** | Address of faulting instruction. |
| SIGFPE |
| SIGSEGV | **void \* *si\_addr*** | Address of faulting memory reference. |
| SIGBUS |
| SIGCHLD | **pid\_t *si\_pid*** | Child process ID. |
|  | **int *si\_status*** | If *si\_code* is equal to CLD\_EXITED, then *si\_status* holds the exit value of the process; otherwise, it is equal to the signal that caused the process to change state. The exit value in *si\_status* shall be equal to the full exit value (that is, the value passed to *\_exit*(), *\_Exit*(), or *exit*(), or returned from *main*()); it shall not be limited to the least significant eight bits of the value. |
|  | **uid\_t *si\_uid*** | Real user ID of the process that sent the signal. |
| SIGPOLL | **long *si\_band*** | Band event for POLL\_IN, POLL\_OUT, or POLL\_MSG. |

For some implementations, the value of *si\_addr* may be inaccurate.

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

```
int    kill(pid_t, int);
int    killpg(pid_t, int);
void   psiginfo(const siginfo_t *, const char *);
void   psignal(int, const char *);
int    pthread_kill(pthread_t, int);
int    pthread_sigmask(int, const sigset_t *restrict,
           sigset_t *restrict);
int    raise(int);
int    sigaction(int, const struct sigaction *restrict,
           struct sigaction *restrict);
int    sigaddset(sigset_t *, int);
int    sigaltstack(const stack_t *restrict, stack_t *restrict);
int    sigdelset(sigset_t *, int);
int    sigemptyset(sigset_t *);
int    sigfillset(sigset_t *);
int    sighold(int);
int    sigignore(int);
int    siginterrupt(int, int);
int    sigismember(const sigset_t *, int);
void (*signal(int, void (*)(int)))(int);
int    sigpause(int);
int    sigpending(sigset_t *);
int    sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);
int    sigqueue(pid_t, int, union sigval);
int    sigrelse(int);
void (*sigset(int, void (*)(int)))(int);
int    sigsuspend(const sigset_t *);
int    sigtimedwait(const sigset_t *restrict, siginfo_t *restrict,
           const struct timespec *restrict);
int    sigwait(const sigset_t *restrict, int *restrict);
int    sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);
```

Inclusion of the *\<signal.h\>* header may make visible all symbols from the *\<time.h\>* header.

*The following sections are informative.*

## APPLICATION USAGE

On systems not supporting the XSI option, the *si\_pid* and *si\_uid* members of **siginfo\_t** are only required to be valid when *si\_code* is SI\_USER or SI\_QUEUE. On XSI-conforming systems, they are also valid for all *si\_code* values less than or equal to 0; however, it is unspecified whether SI\_USER and SI\_QUEUE have values less than or equal to zero, and therefore XSI applications should check whether *si\_code* has the value SI\_USER or SI\_QUEUE or is less than or equal to 0 to tell whether *si\_pid* and *si\_uid* are valid.

## RATIONALE

None.

## FUTURE DIRECTIONS

The SIGPOLL and SIGPROF signals may be removed in a future version.

## SEE ALSO

***\<errno.h\>***, ***\<stropts.h\>***, ***\<sys\_types.h\>***, ***\<time.h\>***

The System Interfaces volume of POSIX.1‐2017, *Section 2.2*, *The Compilation Environment*, *alarm()*, *ioctl()*, *kill()*, *killpg()*, *psiginfo()*, *pthread\_kill()*, *pthread\_sigmask()*, *raise()*, *sigaction()*, *sigaddset()*, *sigaltstack()*, *sigdelset()*, *sigemptyset()*, *sigfillset()*, *sighold()*, *siginterrupt()*, *sigismember()*, *signal()*, *sigpending()*, *sigqueue()*, *sigsuspend()*, *sigtimedwait()*, *sigwait()*, *timer\_create()*, *wait()*, *waitid()*

The Shell and Utilities volume of POSIX.1‐2017, *kill*

## COPYRIGHT

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting\_bugs.html .
