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-l1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR213) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD18) SIGCONT 19) SIGSTOP 2
, func can also take other values, such as SIG_IGN and SIG_DFL. SIG_IGN indicates that the signal specified by signumber is ignored. SIG_DFL indicates that the system's default processing function is called. The Return Value Type of the signal function is the same as the func parameter. It is a function pointer pointing to a return value that is null and has an integer parameter. The correct return value should be the processing function of the previous signal. The error returns SIG_ERR.
Signal
I. SignalWe run a program under the shell, can be in the process is running when the keyboard input CTRL + C, you will see that the process has been terminated, in fact, when we type CTRL + C is to send a SIGINT signal to the process, When a hardware interrupt occurs, the system will switch from executing the code to the kernel to handle the signal, while the default processing action of this signal is to terminate the process, so the running process
Http://blog.chinaunix.net/uid-9354-id-2425031.htmlSo I hope that the same way to deal with the multiple occurrences of the signal, it is best to use sigaction. The signal only appears and is processed once, can be used signal.Each time the signal function sets a specific signal processing function (non-sig_ign), it can only take effect once, and each time the process responds to processing the signal, the signal processing function is reverted to the default processing. So if you want to process
Linux signal list, linux signal list
In Linux, each signal name starts with a letter SIG, and each signal corresponds to a digital code. In the header file signum. h, these signals are defined as positive integers. Signal name definition path:/usr/include/i386-linux-gnu/bits/signum. h
To view the correspondence betwee
. Note that the default response of a process to a real-time signal is a process termination.Which of the three ways Linux responds to a signal depends on the parameters passed to the corresponding API function.Iv. Transmission of SignalsThe main functions for sending signals are: Kill (), raise (), Sigqueue (), Alarm (), Setitimer (), and Abort ().Kill (int pid, int signl) can either send a signal to itself or send a signal to another processRaise (i
The translation is as follows:1.1 Linux Process ManagementProcess management is one of the most important functions of the operating system. Efficient process management can ensure a smooth and efficient operation of a program.Linux process management is similar to UNIX's process management. It includes process scheduling, interrupt processing, signaling, process prioritization, context switching, process status, progress memory, and so on.In this sec
is timely, and the signal response usually has a large time delay.
Common Linux signals and their key values:
01 SIGHUP pending (hangup)
02 SIGINT interrupted. When you press ^ c or ^ break from the keyboard
03 SIGQUIT exits. When the user presses the quit key from the keyboard
04 invalid SIGILL command
05 SIGTRAP trace trap: start the process and track Code Execution
06 sigiot iot instructions
07 SIGEMT c
performance.In Linux, there are two types of interrupts. A hard Interrupt, which is caused by a device that needs to be responded to (hard disk I/O interrupts, network adapter interrupts, keyboard interrupts, mouse interrupts). The other is a soft interrupt "Soft Interrupt" for tasks that can be deferred (TCP/IP operations, SCSI protocol operations, etc.). You can find information about hard interrupts in the /proc/interrupts .In multiprocessor envir
Basic conceptsThe signal is a common concept in Linux, for example, we interrupt the foreground process by pressing CTRL + C, and ending the process through the kill command is done through the signal. The following is an example of CTRL + C for a simple description of the signal processing flow:
The user presses CTRL-C and the keyboard input produces a hardware interrupt.
The process's user-space code pauses execution, and the CPU switch
to respond again, and then continue execution. When we enter CTRL + C again, the program ends because the behavior of SIGINT has reverted to the default behavior, which causes the program to exit.Example 2:#include Parsing: The process runs under the terminal, then the process is pause, we then use kill to send a signal to the process, under the other terminal PS aux can find the process number of the running process. Then kill-s Sigquit + process nu
have seen how many fork ()->waitpid () set the SIGCHLD signal before and after the code?Recommendations for using the system () functionThe more secure usage of calling the system () function is given above, but using the system () function is still prone to error, where is it wrong? That is the return value of the system () function, and the introduction to its return value is in the previous article. The system () function is sometimes convenient, but not abusive!1. It is recommended that the
exited in SVR4, which is ignored in 4.3BSD; Sigcont is continued when the process hangs, otherwise it is ignored and cannot be blockedWhen terminating the program, you cannot use Sigkill in a forced situation, because Sigkill does not process the sub-process, but handles itselfLinux supports POSIX standard signals and real-time signals. Below is a brief summary of the Linux signal, with detailed details to see Man 7 signal.The default action has the
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 y
processing program. It first executes the instructions in the signal handler . If the signal handler returns (no call to exit (0or Abort ()), the normal sequence of instructions that the process is executing when the signal is captured is resumed. In a signal handler, it is not possible to determine where the capture signal is being performed by the process. After compiling, execute the program with the KILL command to send a signal to the program--The kill command actually does not mean ' kill
Signal mechanism in Linux kernel-a simple example
Author:Ce123. (http://blog.csdn.net/ce123)
Signal mechanism is an important means of inter-process communication in Unix-like systems. We often use signals to send a short message to a process. For example, if we start a process to read network data packets sent from the remote host through socket, the host has not received the corresponding data due to network factors, the current process is set to t
1.PHP programmer to play Linux series-How to install using CentOS2.PHP programmer to play Linux series-LNMP Environment building3.PHP Programmer play Linux series-Build FTP code development environment4.PHP Programmer play Linux series-backup restore MySQL5.PHP Programmer play Linu
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.