SIGUSR1 and SIGUSR2

SIGUSR1 and SIGUSR2
Description User-defined signals
Default action Abnormal termination of the process
SA_SIGINFO macros

None

On POSIX-compliant platforms, SIGUSR1 and SIGUSR2 are signals sent to a process to indicate user-defined conditions. The symbolic constants for them are defined in the header file signal.h. Symbolic signal names are used because signal numbers can vary across platforms.

Etymology

SIG is a common prefix for signal names. USR is an abbreviation for user-defined.

Usage

Along with the realtime signals SIGRTMIN through SIGRTMAX, the semantics of SIGUSR1 and SIGUSR2 are not specified by POSIX. Use varies widely from one application to another.

Many applications use USR1 to synchronize internal data between threads and processes, for example by the obsolete LinuxThreads threading library under Linux 2.0 (superseded by the Native POSIX Thread Library). Other applications, such as some Versions of dd, will print status when given this signal (BSD-derived systems use SIGINFO for this purpose). USR1 is also often used to tell an application to reload config files; for example, sending the Apache HTTP Server a USR1, will ask the server to stop allowing new connections, wait for the current ones to die, reread the config files, re-open its log files, and restart the server, allowing for relatively smooth in-production changes.

See also