This article describes the Linux signal list in detail. For more information, see
Run the following command to view the list of signals supported by Linux:
~ $ Kill-l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD
18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN
22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO
30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN + 1
36) SIGRTMIN + 2 37) SIGRTMIN + 3 38) SIGRTMIN + 4 39) SIGRTMIN + 5
40) SIGRTMIN + 6 41) SIGRTMIN + 7 42) SIGRTMIN + 8 43) SIGRTMIN + 9
44) SIGRTMIN + 10 45) SIGRTMIN + 11 46) SIGRTMIN + 12 47) SIGRTMIN + 13
(48) SIGRTMIN + 14 49) SIGRTMIN + 15 50) SIGRTMAX-14 51) SIGRTMAX-13
SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9
(56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59)
(60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63)
64) SIGRTMAX
List, numbered 1 ~ The 31 signal is a traditional UNIX-supported signal, which is an unreliable signal (non-real-time) numbered 32 ~ The 63 signal was expanded later, called a reliable signal (real-time signal ). The difference between unreliable and reliable signals is that the former does not support queuing and may cause signal loss, while the latter does not.
Below we will discuss the signal number smaller than SIGRTMIN.
1) SIGHUP
This signal is sent at the end of the user terminal connection (normal or abnormal). Generally, when the control process of the terminal ends, it notifies all jobs in the same session, they are no longer associated with control terminals.
When you log on to Linux, the system assigns a Session to the login user ). All programs running on this terminal, including foreground and background process groups, generally belong to this Session. When you log out of Linux, processes in the frontend process Group and in the background that are output to the terminal will receive a SIGHUP signal. The default operation for this signal is to terminate the process. Therefore, the process with terminal output in the frontend and backend will be aborted. However, this signal can be captured. for example, wget can capture the SIGHUP signal and ignore it. in this way, even if you log out of Linux, wget can continue downloading.
In addition, this signal is used to notify the daemon that is out of the relationship with the terminal to re-read the configuration file.
2) SIGINT
The interrupt signal is sent when you type the INTR character (usually Ctrl-C) to notify the foreground process Group to terminate the process.
3) SIGQUIT
Similar to SIGINT, but controlled by the QUIT character (usually Ctrl-\). a process generates a core file when it exits because it receives a SIGQUIT exit. In this sense, it is similar to a program error signal.
4) SIGILL
The execution of invalid commands is usually caused by errors in the executable file, or the attempt to execute data segment. Stack Overflow may also generate this signal.
5) SIGTRAP
Generated by breakpoint commands or other trap commands. Used by debugger.
6) SIGABRT
The signal generated by calling the abort function.
7) SIGBUS
Invalid address, including memory address alignment error. For example, you can access an integer with four characters in length, but its address is not a multiple of 4. It differs from SIGSEGV in that the latter is triggered by illegal access to valid storage addresses (for example, access does not belong to your own bucket or read-only bucket ).
8) SIGFPE
When a fatal arithmetic operation error occurs, it includes not only floating point operation errors, but also overflow and Division 0 and other arithmetic errors.
9) SIGKILL
It is used to immediately end the running of the program. this signal cannot be blocked, processed, or ignored. If the administrator finds that a process cannot be terminated, he can try to send this signal.
10) SIGUSR1
Reserved for users
11) SIGSEGV
Try to access the memory not allocated to you, or try to write data to the memory address that has no write permission.
12) SIGUSR2
Reserved for users
13) SIGPIPE
Pipe rupture. This signal is usually generated during inter-process communication. for example, for two processes that use FIFO (pipeline) communication, the read pipeline is written to the pipeline if it is not opened or unexpectedly terminated, and the write process receives the SIGPIPE signal. In addition, when writing a Socket to two processes that communicate with a Socket, the read process is terminated.
14) SIGALRM
The scheduled clock signal is used to calculate the actual time or clock time. the alarm function uses this signal.
15) SIGTERM
The program terminate signal. Unlike SIGKILL, the signal can be blocked and processed. It is usually used to require the program to exit normally. the shell command kill generates this signal by default. If the process cannot be terminated, we will try SIGKILL.
17) SIGCHLD
When the child process ends, the parent process receives this signal.
If the parent process does not process this signal and does not wait for the child process (wait), although the child process terminates, it still occupies a table item in the kernel table, at this time, sub-processes are called zombie processes. In this situation, we should avoid (parent process, ignore SIGCHILD signal, capture it, or wait, its derived child process, or the parent process is terminated first, at this time, the termination of the sub-process is automatically taken over by the init process ).
18) SIGCONT
Let a stopped process continue execution. this signal cannot be blocked. A handler can be used to allow a program to complete a specific job when it changes from the stopped state to the continue execution. for example, re-display the prompt
19) SIGSTOP
Stop (stopped) process execution. Note the difference between it and terminate and interrupt: The process has not ended, but is paused. this signal cannot be blocked, processed, or ignored.
20) SIGTSTP
The process is stopped, but the signal can be processed and ignored. this signal is sent when you type the SUSP character (usually Ctrl-Z ).
21) SIGTTIN
When a background job reads data from a user terminal, all processes in the job receive the SIGTTIN signal.
22) SIGTTOU
Similar to SIGTTIN, but received when writing terminal (or modifying terminal mode.
23) SIGURG
It is generated when "urgent" data or out-of-band data reaches the socket.
24) SIGXCPU
The CPU time limit is exceeded. this limit can be read/changed by getrlimit/setrlimit.
25) SIGXFSZ
When a process attempts to expand a file so that it exceeds the file size resource limit.
26) SIGVTALRM
The virtual clock signal is similar to SIGALRM, but the CPU time occupied by the process is calculated.
27) SIGPROF
Similar to SIGALRM/SIGVTALRM, but includes the CPU time used by the process and the time when the system calls it.
28) SIGWINCH
Window size changed.
29) SIGIO
The file descriptor is ready for input/output operations.
30) SIGPWR
Power failure
31) SIGSYS
Invalid system call.
Among the signals listed above, signals that cannot be captured, blocked, or ignored by the program are: SIGKILL, SIGSTOP
Signals that cannot be restored to the default action include: SIGILL and SIGTRAP.
By default, the signals that cause process abortion include: SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGIOT, SIGQUIT, SIGSEGV, SIGTRAP, SIGXCPU, SIGXFSZ
By default, the process exits with the following signals: SIGALRM, SIGHUP, SIGINT, SIGKILL, SIGPIPE, SIGPOLL, SIGPROF, SIGSYS, SIGTERM, SIGUSR1, SIGUSR2, and SIGVTALRM.
By default, the signal that causes the process to stop is: SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU
Signals Ignored by default include SIGCHLD, SIGPWR, SIGURG, and SIGWINCH.
In addition, SIGIO exits in SVR4 and is ignored in 4.3BSD; SIGCONT continues when the process is suspended; otherwise, it is ignored and cannot be blocked.
The following is a supplement from other netizens:
SIGHUP
SIGINT terminates process interruption
SIGQUIT creates a CORE file to terminate the process and generates a core file
Invalid command for creating CORE file in SIGILL
SIGTRAP creates CORE file tracking self-traps
Sigbus core file bus creation error
Invalid sigsegv core file segment creation error
An error occurred while creating the CORE file floating point in SIGFPE.
SIGIOT creates CORE file execution I/O Self-traps
SIGKILL terminate the process and kill the process
SIGPIPE terminates a process and writes data to an unread process pipeline.
When SIGALARM terminates the process timer
SIGTERM termination process software termination signal
SIGSTOP stop signal of non-terminal stop process
SIGTSTP stop signal from the process terminal
SIGCONT ignores the signal and continues a stopped process.
SIGURG ignores signal I/O emergency signals
SIGIO can ignore the I/O on the signal descriptor
SIGCHLD ignores the signal and notifies the parent process when the child process stops or exits.
SIGTTOU stops the process background process writing terminal
SIGTTIN stops the process background process Read Terminal
SIGXGPU termination process CPU timeout
The length of the SIGXFSZ termination process file is too long.
SIGWINCH ignores changing signal window size
SIGPROF termination process statistical distribution when timer is used
SIGUSR1 termination process user-defined Signal 1
SIGUSR2 termination process user-defined signal 2
When SIGVTALRM terminates the virtual timer of the process
1) the SIGHUP signal is sent at the end of the user terminal connection (normal or abnormal), usually in the terminal's control
When the process ends, each job in the same session is notified.
No longer associated.
2) the SIGINT program termination (interrupt) signal is sent when you type the INTR character (usually Ctrl-C)
3) SIGQUIT is similar to SIGINT, but it is controlled by the QUIT character (usually Ctrl -).
The core file is generated when SIGQUIT exits. In this sense, it is similar to a program error message.
No.
4) SIGILL executes invalid commands. this is usually because the executable file itself has an error or an attempt to execute
Data Segment. this signal may also be generated when the stack overflows.
5) SIGTRAP is generated by the breakpoint instruction or other trap instruction. it is used by the debugger.
6) when the SIGABRT program finds an error and calls abort.
6) SIGIOT is generated by iot instructions on the PDP-11, and is the same as SIGABRT on other machines.
7) SIGBUS illegal address, including memory address alignment error. eg: access a four-character long
But its address is not a multiple of 4.
(8) SIGFPE is triggered when a fatal arithmetic operation error occurs. This includes not only floating point operation errors, but also overflow.
An error occurs in all other arithmetic operations, such as 0 in the output and devisor.
9) SIGKILL is used to immediately end program running. this signal cannot be blocked, processed, or ignored.
10) SIGUSR1 is reserved for users
11) SIGSEGV tries to access the memory not allocated to itself, or try to write data to the memory address with no write permission.
12) SIGUSR2 is reserved for users.
13) SIGPIPE Broken pipe
14) the SIGALRM clock timing signal calculates the actual time or clock time. the alarm function uses this
Signal.
15) the SIGTERM program terminate signal. Unlike SIGKILL, this signal can be blocked and
Processing. it is usually used to require the program to exit normally. shell command kill will generate this by default
Signal (s.
17) when the SIGCHLD sub-process ends, the parent process will receive this signal.
18) SIGCONT allows a stopped process to continue execution. this signal cannot be blocked.
A handler that enables a program to complete a specific task when it changes from stopped to continue execution.
Job. for example, re-display the prompt
19) SIGSTOP stop (stopped) process execution. note the differences between it and terminate and interrupt:
This process has not ended, but is paused. this signal cannot be blocked, processed, or ignored.
20) SIGTSTP stops the process, but the signal can be processed and ignored.
(Usually Ctrl-Z) sends this signal
21) SIGTTIN when the background job needs to read data from the user terminal, all processes in the job will receive SIGTTIN
Signal. due to lack of time, these processes will stop running.
22) SIGTTOU is similar to SIGTTIN, but it is received when the write terminal (or modify the terminal mode.
23) SIGURG has "urgent" data or out-of-band data generated when it reaches the socket.
24) the SIGXCPU exceeds the CPU time limit. this limit can be read by getrlimit/setrlimit/
Change
25) SIGXFSZ exceeds the file size resource limit.
26) SIGVTALRM virtual clock signal. similar to SIGALRM, the CPU time occupied by the process is calculated.
27) SIGPROF is similar to SIGALRM/SIGVTALRM, but includes the CPU time used by the process and
Time.
28) it is issued when the SIGWINCH window size is changed.
29) the SIGIO file descriptor is ready for input/output operations.
30) SIGPWR Power failure
There are two signals to stop the process: SIGTERM and SIGKILL. SIGTERM is relatively friendly, and processes can capture this signal and close the program as needed. Before closing the program, you can end the opened record file and complete ongoing tasks. In some cases, if a process is running and cannot be interrupted, the process can ignore this SIGTERM signal.
Processes cannot ignore SIGKILL signals. This is a signal "I don't care what you are doing, stop immediately. If you send a SIGKILL signal to the process, Linux stops the process.