[Switch] useful for linux signal programming: Number of CITIC numbers in Linux
Source: Internet
Author: User
[Switch] It is useful for linux signal programming: Number of Linux signals-Linux general technology-Linux programming and kernel information. For details, refer to the following. Http://www.xxlinux.com/linux/art... 07-10-30/11340. html
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.
Note:
* The response sequence of multiple real-time signals is guaranteed.
* If a process has both real-time and standard signals in pending, standard signals are preferentially returned.
Generally, real-time signals are non-real-time signals. below is the signal list.
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 of this signal is to terminate the process. Therefore, the processes in the foreground process group and the background that have terminal output will be aborted. However, this signal can be captured. For example, if wget can capture the SIGHUP signal and ignore it, wget can continue downloading even if it exits the Linux logon.
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 ).
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 case, we should avoid (parent process, ignore the SIGCHILD signal, or 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 ).
1 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
"Urgent" data or out-of-band data is generated when it 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.
2 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, 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 content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.