[Debug] Native Exception Learning (III.)--signal

Source: Internet
Author: User
Tags arithmetic posix terminates

1, the common meaning of the signal

Sighup (1) (POSIX) [Terminate]
A user terminal connection (normal or abnormal) is issued at the end, usually at the end of the control process of the terminal, notifying each job within the same session, when they are no longer associated with the control terminal
SIGINT (2) (ANSI) [Terminate]
program termination (interrupt) signal issued when the user types a intr character (usually Ctrl-c) to notify the foreground process group to terminate the process
Sigquit (3) (POSIX) [Terminate +coredump]
Similar to SIGINT, but controlled by quit characters (usually ctrl-\). A process produces a core file when it exits Sigquit, in the sense that it is similar to a program error signal
Sigill (4) (ANSI) [Terminate +coredump]
Illegal directives were executed. Typically, an error occurs in the executable itself, or an attempt is made to execute a data segment. This signal may also be generated when the stack overflows
Sigtrap (5) (POSIX) [Terminate +coredump]
Generated by a breakpoint instruction or other trap instruction. Used by debugger
SIGABRT (6) (ANSI) [Terminate +coredump]
Call the signal generated by the Abort function
Sigbus (7) (4.2 BSD) [Terminate +coredump]
Illegal address, including memory address alignment (alignment) error. For example, a four-word integer is accessed, but its address is not a multiple of 4. It differs from SIGSEGV in that the latter is triggered by illegal access to a legitimate storage address (e.g., access is not in its own storage or read-only storage space)
SIGFPE (8) (ANSI) [Terminate +coredump]
Emitted when a fatal arithmetic operation error occurs. Includes not only floating-point arithmetic errors, but also all other arithmetic errors such as overflow and divisor 0.
SIGKILL (9) (POSIX) [Terminate]
Used to immediately end a program's operation. This signal cannot be blocked, captured, or ignored. If an administrator discovers that a process cannot be terminated, try sending this signal
SIGSEGV (ANSI) [Terminate +coredump]
Attempt to access memory not assigned to itself, or attempt to write data to a memory address that does not have write access
Sigpipe (POSIX) [Terminate]
The pipe is broken. This signal usually occurs during interprocess communication, such as two processes using FIFO (pipe) communication, the read pipe is not opened or accidentally terminated to the pipeline, write process will receive sigpipe signal. In addition, with socket communication two processes, write process in the write socket, read process has terminated
SIGALRM (POSIX) [Terminate]
Clock timing signal, calculated is the actual time or clock time. The alarm function uses this signal
Sigterm (ANSI) [Terminate]
Program end (terminate) signal, unlike Sigkill, the signal can be blocked and processed. Typically used to require the program to exit normally, the shell command kill defaults to generate this signal. If the process doesn't stop, we'll try Sigkill.
Sigstkflt (16) [end]
Stack error
SIGCHLD (POSIX) [Ignore]
The parent process receives this signal at the end of the child process. If the parent process does not process this signal, and there is no wait child process, the child process terminates, but also occupies the table entry in the kernel process table, where the subprocess is called the zombie process. In this case we should avoid (the parent process either ignores the sigchild signal, or catches it, or wait for the child process it derives, or the parent process terminates first, when the termination of the child process is automatically taken over by the Init process)
Sigcont (POSIX) [Continue/ignore]
Let a stop (stopped) process continue. This signal cannot be blocked. You can use a handler to allow a program to perform a specific job when the stopped state becomes a continuation. For example, re-display the prompt ...
Continue when the process hangs, otherwise it is ignored
SIGSTOP (POSIX) [paused]
Suspends execution of a process. Notice the difference between it and terminate and interrupt: The process is not finished, it's just suspending execution. This signal cannot be blocked, captured, or ignored
SIGVTALRM (4.2 BSD) [terminated]
The virtual timing clock signal, calculated is the time spent by the user space, the Setitimer function can set the Itimer_virtual type timer, timed out to emit such signals
Sigprof (4.2 BSD) [end]
Profile Timer timing signal, calculated is the user Space+kernel space spent time, the Setitimer function can set the ITIMER_PROF type timer, timed out such signals



2. Classification of Signals

All signals between the 1~31 are called unreliable signals, the reason is that the signal can not be queued, if the kernel found that the same signal has been suspended signal, the current signal will be discarded, as if it has never been sent, the signal can not be transmitted, nor can the process to perform signal processing functions. The mechanism of this implementation has caused these signals to be unreliable. To solve this problem, Linux introduces real-time signals, which are in [32~64] intervals, or are called reliable signals. This signal, kernel will not ignore, even if there are a lot of the same signal, kernel will send the new signal into the queue, waiting to be passed out.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.