Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Signal (IPC)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==POSIX signals== The list below documents the signals specified in the [[Single UNIX Specification|Single Unix Specification]] Version 5. All signals are defined as macro constants in the <code><signal.h></code> header file. The name of the macro constant consists of a "SIG" [[prefix]] followed by a mnemonic name for the signal. A process can define [[C signal handling|how to handle incoming POSIX signals]]. If a process does not define a behaviour for a signal, then the ''default handler'' for that signal is being used. The table below lists some default actions for POSIX-compliant UNIX systems, such as [[FreeBSD]], [[OpenBSD]] and [[Linux]]. {| class="wikitable sortable" |- ! Signal !! data-sort-type="number"|Portable<br/>number !! Default action !! class="unsortable"|Description |- | SIGABRT || style="text-align:right" | 6 || {{terminated|Terminate}} (core dump) || Process abort signal |- | SIGALRM || style="text-align:right" | 14 || {{terminated|Terminate}} || Alarm clock |- | SIGBUS || {{n/a}} || {{terminated|Terminate}} (core dump) || Access to an undefined portion of a memory object |- | SIGCHLD || {{n/a}} || style="text-align:center" | Ignore || Child process terminated, stopped, or continued |- | SIGCONT || {{n/a}} || style="text-align:center" | Continue || Continue executing, if stopped |- | SIGFPE || style="text-align:right" | 8 || {{terminated|Terminate}} (core dump) || Erroneous arithmetic operation |- | SIGHUP || style="text-align:right" | 1 || {{terminated|Terminate}} || Hangup |- | SIGILL || style="text-align:right" | 4 || {{terminated|Terminate}} (core dump) || Illegal instruction |- | SIGINT || style="text-align:right" | 2 || {{terminated|Terminate}} || Terminal interrupt signal |- | SIGKILL || style="text-align:right" | 9 || {{terminated|Terminate}} || Kill (cannot be caught or ignored) |- | SIGPIPE || style="text-align:right" | 13 || {{terminated|Terminate}} || Write on a pipe with no one to read it |- | SIGQUIT || style="text-align:right" | 3 || {{terminated|Terminate}} (core dump) || Terminal quit signal |- | SIGSEGV || style="text-align:right" | 11 || {{terminated|Terminate}} (core dump) || Invalid memory reference |- | SIGSTOP || {{n/a}} || {{dropped|Stop}} || Stop executing (cannot be caught or ignored) |- | SIGSYS || {{n/a}} || {{terminated|Terminate}} (core dump) || Bad system call |- | SIGTERM || style="text-align:right" | 15 || {{terminated|Terminate}} || Termination signal |- | SIGTRAP || style="text-align:right" | 5 || {{terminated|Terminate}} (core dump) || Trace/breakpoint trap |- | SIGTSTP || {{n/a}} || {{dropped|Stop}} || Terminal stop signal |- | SIGTTIN || {{n/a}} || {{dropped|Stop}} || Background process attempting read |- | SIGTTOU || {{n/a}} || {{dropped|Stop}} || Background process attempting write |- | SIGUSR1 || {{n/a}} || {{terminated|Terminate}} || User-defined signal 1 |- | SIGUSR2 || {{n/a}} || {{terminated|Terminate}} || User-defined signal 2 |- | SIGURG || {{n/a}} || style="text-align:center" | Ignore || [[Out-of-band data]] is available at a socket |- | SIGVTALRM || {{N/A}} || {{terminated|Terminate}} || Virtual timer expired |- | SIGXCPU || {{n/a}} || {{terminated|Terminate}} (core dump) || CPU time limit exceeded |- | SIGXFSZ || {{n/a}} || {{terminated|Terminate}} (core dump) || File size limit exceeded |- | SIGWINCH || {{n/a}} || style="text-align:center" | Ignore || Terminal window size changed |} ; ''Portable number:'' : For most signals the corresponding signal number is implementation-defined. This column lists the numbers specified in the POSIX standard.<ref>{{cite web|title=IEEE Std 1003.1-2017 - kill|url=https://pubs.opengroup.org/onlinepubs/9699919799/utilities/kill.html|publisher=IEEE, Open Group|quote=The correspondence between integer values and the ''sig'' value used is shown in the following list. The effects of specifying any ''signal_number'' other than those listed below are undefined.}}</ref> ; ''Actions explained:'' : '''Terminate'''{{snd}} Abnormal termination of the process. The process is terminated with all the consequences of _exit() except that the status made available to wait() and waitpid() indicates abnormal termination by the specified signal. : '''Terminate (core dump)'''{{snd}} Abnormal termination of the process. Additionally, implementation-defined abnormal termination actions, such as creation of a core file, may occur. : '''Ignore'''{{snd}} Ignore the signal. : '''Stop'''{{snd}} Stop (or suspend) the process. : '''Continue'''{{snd}} Continue the process, if it is stopped; otherwise, ignore the signal. ; {{mono|{{vanchor|SIGABRT}}}} and {{mono|{{vanchor|SIGIOT}}}} : The SIGABRT signal is sent to a process to tell it to [[Abort (computing)|'''abort''']], i.e. to terminate. The signal is usually initiated by the process itself when it calls [[C process control#abort|<code>abort()</code>]] function of the [[C Standard Library]], but it can be sent to the process from outside like any other signal. : SIGIOT indicates that the CPU has executed an explicit "trap" instruction (without a defined function), or an unimplemented instruction (when emulation is unavailable). ::''Note: "input/output trap" is a misnomer for any CPU "trap" instruction. The term reflects early usage of such instructions, predominantly to implement I/O functions, but they are not inherently tied to device I/O and may be used for other purposes such as communication between virtual & real hosts.'' : SIGIOT and SIGABRT are typically the same signal, and receipt of that signal may indicate any of the conditions above. ; {{mono|{{vanchor|SIGALRM}}}}, {{mono|{{vanchor|SIGVTALRM}}}} and {{mono|{{vanchor|SIGPROF}}}} : The SIGALRM, SIGVTALRM and SIGPROF signals are sent to a process when the corresponding time limit is reached. The process sets these time limits by calling <code>alarm</code> or <code>setitimer</code>. The time limit for SIGALRM is based on real or clock time; SIGVTALRM is based on CPU time used by the process; and SIGPROF is based on CPU time used by the process and by the system on its behalf (known as a ''profiling timer''). On some systems SIGALRM may be used internally by the implementation of the <code>sleep</code> function. ; {{mono|{{vanchor|SIGBUS}}}} : The [[SIGBUS]] signal is sent to a process when it causes a '''[[bus error]]'''. The conditions that lead to the signal being sent are, for example, incorrect memory access alignment or non-existent physical address. ; {{mono|{{vanchor|SIGCHLD}}}} : The [[child process|SIGCHLD]] signal is sent to a process when a '''[[child process]]''' [[exit (system call)|terminates]], is stopped, or resumes after being stopped. One common usage of the signal is to instruct the operating system to clean up the resources used by a child process after its termination without an explicit call to the <code>[[wait (system call)|wait]]</code> system call. ; {{mono|{{vanchor|SIGCONT}}}} : The [[SIGCONT]] signal instructs the operating system to '''continue''' (restart) a process previously paused by the SIGSTOP or SIGTSTP signal. One important use of this signal is in [[job control (Unix)|job control]] in the [[Unix shell]]. ; {{mono|{{vanchor|SIGFPE}}}} : The SIGFPE signal is sent to a process when an exceptional (but not necessarily erroneous) condition has been detected in the floating-point or integer arithmetic hardware. This may include [[division by zero]], floating-point underflow or overflow, [[integer overflow]], an invalid operation or an inexact computation. Behaviour may differ depending on hardware. ; {{mono|{{vanchor|SIGHUP}}}} : The [[SIGHUP]] signal is sent to a process when its controlling terminal is closed. It was originally designed to notify the process of a [[RS-232|serial line]] drop (a '''hangup'''). In modern systems, this signal usually means that the controlling [[Terminal emulator|pseudo or virtual terminal]] has been closed.<ref name="linux-signal7">{{cite web |url=https://www.kernel.org/doc/man-pages/online/pages/man7/signal.7.html|title=signal(7) |work=[[Linux Programmer's Manual]] (version 3.22)|author=Michael Kerrisk | date=25 July 2009|publisher=The Linux Kernel Archives|access-date=23 September 2009}}</ref> Many [[daemon (computing)|daemons]] (who have no controlling terminal) interpret receipt of this signal as a request to reload their configuration files and flush/reopen their logfiles instead of exiting.<ref>{{cite web|title=perlipc(1)|url=https://perldoc.perl.org/perlipc.html#Handling-the-SIGHUP-Signal-in-Daemons|work=Perl Programmers Reference Guide, version 5.18|publisher=perldoc.perl.org - Official documentation for the Perl programming language|access-date=21 September 2013}}</ref> [[nohup]] is a command to make a command ignore the signal. ; {{mono|{{vanchor|SIGILL}}}} : The SIGILL signal is sent to a process when it attempts to execute an '''illegal''', malformed, unknown, or privileged [[instruction (computer science)|instruction]]. ; {{mono|{{vanchor|SIGINT}}}} : The SIGINT signal is sent to a process by its controlling terminal when a user wishes to '''interrupt''' the process. This is typically initiated by pressing [[Control-C|{{keypress|Ctrl|C}}]], but on some systems, the "[[Delete key|delete]]" character or "[[break key|break]]" key can be used.<ref>{{cite web | url=https://www.cons.org/cracauer/sigint.html | title=Proper handling of SIGINT and SIGQUIT | access-date=6 October 2012}}</ref> ; {{mono|{{vanchor|SIGKILL}}}} : The SIGKILL signal is sent to a process to cause it to terminate immediately ('''kill'''). In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal. The following exceptions apply: :* [[Zombie process]]es cannot be killed since they are already dead and waiting for their parent processes to reap them. :* Processes that are in the blocked state will not die until they wake up again. :* The ''[[init]]'' process is special: It does not get signals that it does not want to handle, and thus it can ignore SIGKILL.<ref>https://manpages.ubuntu.com/manpages/zesty/man2/kill.2.html {{Webarchive|url=https://web.archive.org/web/20180128103316/https://manpages.ubuntu.com/manpages/zesty/man2/kill.2.html |date=28 January 2018 }} section NOTES</ref> An exception from this rule is while init is [[ptrace]]d on Linux.<ref>{{cite web|url=https://stackoverflow.com/a/21031583|title=SIGKILL init process (PID 1)|website=Stack Overflow}}</ref><ref>{{cite web|url=https://unix.stackexchange.com/a/308429|title=Can root kill init process?|website=Unix & Linux Stack Exchange}}</ref> :* An [[uninterruptible sleep|uninterruptibly sleeping]] process may not terminate (and free its resources) even when sent SIGKILL. This is one of the few cases in which a UNIX system may have to be rebooted to solve a temporary software problem. :SIGKILL is used as a last resort when terminating processes in most system [[shutdown (computing)|shutdown]] procedures if it does not voluntarily exit in response to SIGTERM. To speed the computer shutdown procedure, Mac OS X 10.6, aka [[Mac OS X Snow Leopard|Snow Leopard]], will send SIGKILL to applications that have marked themselves "clean" resulting in faster shutdown times with, presumably, no ill effects.<ref>{{cite web | url = https://developer.apple.com/mac/library/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html#//apple_ref/doc/uid/TP40008898-SW22 | title = Mac Dev Center: What's New in Mac OS X: Mac OS X v10.6 | date = 2009-08-28 | access-date =18 November 2017}}</ref> The command {{code|killall -9}} has a similar, while dangerous effect, when executed e.g. in Linux; it does not let programs save unsaved data. It has other options, and with none, uses the safer SIGTERM signal. ; {{mono|{{vanchor|SIGPIPE}}}} : The SIGPIPE signal is sent to a process when it attempts to write to a [[Pipeline (Unix)|pipe]] without a process connected to the other end. ; {{mono|{{vanchor|SIGPOLL}}}} : The SIGPOLL signal is sent when an event occurred on an explicitly watched file descriptor.<ref>{{cite web | title=ioctl - controls a STREAM device | work=[[POSIX]] system call specification | publisher=[[The Open Group]] | url=https://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html | access-date=19 June 2015}}</ref> Using it effectively leads to making [[asynchronous I/O]] requests since the kernel will '''poll''' the descriptor in place of the caller. It provides an alternative to active [[Polling (computer science)|polling]]. ; {{mono|{{vanchor|SIGRTMIN}}}} to {{mono|{{vanchor|SIGRTMAX}}}} : The SIGRTMIN to SIGRTMAX signals are intended to be used for user-defined purposes. They are '''real-time''' signals. ; {{mono|{{vanchor|SIGQUIT}}}} : The SIGQUIT signal is sent to a process by its controlling terminal when the user requests that the process '''quit''' and perform a [[core dump]]. ; {{mono|{{vanchor|SIGSEGV}}}} : The [[SIGSEGV]] signal is sent to a process when it makes an invalid virtual memory reference, or [[segmentation fault]], i.e. when it performs a '''seg'''mentation '''v'''iolation.<ref>{{Cite web|url=https://support.microfocus.com/kb/doc.php?id=7001662|title=What is a "segmentation violation"?|website=support.microfocus.com|access-date=2018-11-22}}</ref> ; {{mono|{{vanchor|SIGSTOP}}}} : The [[SIGSTOP]] signal instructs the operating system to '''stop''' a process for later resumption. ; {{mono|{{vanchor|SIGSYS}}}} : The SIGSYS signal is sent to a process when it passes a bad argument to a [[system call]]. In practice, this kind of signal is rarely encountered since applications rely on libraries (e.g. [[C standard library|libc]]) to make the call for them. SIGSYS can be received by applications violating the Linux [[Seccomp]] security rules configured to restrict them. SIGSYS can also be used to emulate foreign system calls, e.g. emulate Windows system calls on Linux.<ref>{{Cite web|title=Syscall User Dispatch β The Linux Kernel documentation|url=https://www.kernel.org/doc/html/latest/admin-guide/syscall-user-dispatch.html|access-date=2021-02-11|website=kernel.org}}</ref> ; {{mono|{{vanchor|SIGTERM}}}} : The SIGTERM signal is sent to a process to request its '''termination'''. Unlike the SIGKILL signal, it can be caught and interpreted or ignored by the process. This allows the process to perform nice termination releasing resources and saving state if appropriate. SIGINT is nearly identical to SIGTERM. ; {{mono|{{vanchor|SIGTSTP}}}} : The [[SIGTSTP]] signal is sent to a process by its controlling '''terminal''' to request it to '''stop''' ('''t'''erminal '''st'''o'''p'''). It is commonly initiated by the user pressing [[Ctrl-Z|{{keypress|Ctrl|Z}}]]. Unlike SIGSTOP, the process can register a signal handler for, or ignore, the signal. ; {{mono|{{vanchor|SIGTTIN}}}} and {{mono|{{vanchor|SIGTTOU}}}} : The [[SIGTTIN]] and [[SIGTTOU]] signals are sent to a process when it attempts to read '''in''' or write '''out''' respectively from the [[teletypewriter|'''tty''']] while in the [[Background process|background]]. Typically, these signals are received only by processes under [[job control (Unix)|job control]]; [[daemon (computing)|daemons]] do not have controlling terminals and, therefore, should never receive these signals. ; {{mono|{{vanchor|SIGTRAP}}}} : The SIGTRAP signal is sent to a process when an exception (or '''trap''') occurs: a condition that a [[debugger]] has requested to be informed of{{snd}} for example, when a particular [[subroutine|function]] is executed, or when a particular [[variable (computer science)|variable]] changes value. ; {{mono|{{vanchor|SIGURG}}}} : The [[SIGURG]] signal is sent to a process when a [[Berkeley sockets|socket]] has '''urgent''' or [[out-of-band data]] available to read. ; {{mono|{{vanchor|SIGUSR1}}}} and {{mono|{{vanchor|SIGUSR2}}}} : The SIGUSR1 and SIGUSR2 signals are sent to a process to indicate '''user-defined conditions'''. ; {{mono|{{vanchor|SIGXCPU}}}} : The SIGXCPU signal is sent to a process when it has used up the '''[[Central processing unit|CPU]]''' for a duration that '''exceeds''' a certain predetermined user-settable value.<ref name="setrlimit_posix_spec">{{cite web | title = getrlimit, setrlimit - control maximum resource consumption | work=[[POSIX]] system call specification | publisher=[[The Open Group]] | url=https://pubs.opengroup.org/onlinepubs/009695399/functions/getrlimit.html | access-date = 10 September 2009}}</ref> The arrival of a SIGXCPU signal provides the receiving process a chance to quickly save any intermediate results and to exit gracefully, before it is terminated by the operating system using the SIGKILL signal. ; {{mono|{{vanchor|SIGXFSZ}}}} : The SIGXFSZ signal is sent to a process when it grows a '''file''' that '''exceeds''' the maximum allowed '''size'''. ; {{mono|{{vanchor|SIGWINCH}}}} : The SIGWINCH signal is sent to a process when its controlling terminal changes its size (a '''win'''dow '''ch'''ange).<ref>{{cite web |url=http://austingroupbugs.net/view.php?id=1151 |title= 0001151: Introduce new signal SIGWINCH and functions tcsetsize(), tcgetsize() to get/set terminal window size |last=Clausecker |first=Robert |date=2017-06-19 |website=Austin Group Defect Tracker |publisher=[[Austin Group]] |access-date=2017-10-12 |quote=Accepted As Marked}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)