一个信号,是一个信息,可以发送到运行的过程。
Signals can be initiated by programs, users, or administrators.信号可启动程式,使用者或管理员。
For example, to the proper method of telling the Internet Daemon (inetd) to re-read its configuration file is to send it a SIGHUP signal.举例来说,以适当的方法告诉互联网守护进程 ( inetd的) ,以重看其配置文件,是发送一个sighup信号。
For example, if the current process ID (PID) of inetd is 4140, we would type:举例来说,如果当前的进程ID ( PID控制)的inetd的是4140年,我们会类型:
kill -SIGHUP 4140
Another common use of signals is to stop a running process.另一种普遍使用的信号是停止一个运行的过程。 To stop the inetd process completely, we would use this command:停止inetd的进程完全中,我们会用这个命令:
kill 4140
By default, the kill command sends the SIGTERM signal.默认情况下,杀死指挥移送sigterm信号。 If SIGTERM fails, we can escalate to using the SIGKILL signal to stop the process:如果sigterm失败的话,我们可以升级使用sigkill信号,以阻止过程:
kill -9 4140
Because SIGKILL cannot be handled, stopping a process with SIGKILL is generally considered a bad idea.因为sigkill不能处理,制止过程中与sigkill被普遍认为是一个坏主意。 Using SIGKILL prevents a process from cleaning up after itself and exiting gracefully.用sigkill阻止一个进程,从清理后,本身并退出缓慢下降。
Each Unix signal has a default set of effects on a Unix program.每个Unix信号具有默认设置的效果上的Unix程序。 Programmers can code their applications to respond in customized ways to most signals.程序员可以码及其应用响应定制的方式,以最信号。 These custom pieces of code are called signal handlers .这些习俗件代码是所谓的信号处理 。
Two signals are unable to be redefined by a signal handler.两路信号无法重新定义,由一个信号处理器。 SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. sigkill总是站有一个过程, sigstop总是一个过程,从前台到后台。 These two signals cannot be "caught" by a signal handler.这两个信号不能被"捕获"的一个信号处理器。
SIGHUP | 1 | Terminal line hangup |
SIGINT | 2 | Interrupt program |
SIGQUIT | 3 | Quit program |
SIGILL | 4 | Illegal instruction |
SIGTRAP | 5 | Trace trap |
SIGABRT | 6 | Abort |
SIGEMT | 7 | Emulate instruction executed |
SIGFPE | 8 | Floating-point exception |
SIGKILL | 9 | Kill program |
SIGBUS | 10 | Bus error |
SIGSEGV | 11 | Segmentation violation |
SIGSYS | 12 | Bad argument to system call |
SIGPIPE | 13 | Write on a pipe with no one to read it |
SIGALRM | 14 | Real-time timer expired |
SIGTERM | 15 | Software termination signal |
SIGURG | 16 | Urgent condition on I/O channel |
SIGSTOP | 17 | Stop signal not from terminal |
SIGTSTP | 18 | Stop signal from terminal |
SIGCONT | 19 | A stopped process is being continued |
SIGCHLD | 20 | Notification to parent on child stop or exit |
SIGTTIN | 21 | Read on terminal by background process |
SIGTTOU | 22 | Write to terminal by background process |
SIGIO | 23 | I/O possible on a descriptor |
SIGXCPU | 24 | CPU time limit exceeded |
SIGXFSZ | 25 | File-size limit exceeded |
SIGVTALRM | 26 | Virtual timer expired |
SIGPROF | 27 | Profiling timer expired |
SIGWINCH | 28 | Window size changed |
SIGINFO | 29 | Information request |
SIGUSR1 | 30 | User-defined signal 1 |
SIGUSR2 | 31 | User-defined signal 2 |
SIGTHR | 32 | Thread interrupt |
SIGHUP | 1 | Hangs up |
SIGINT | 2 | Interrupts |
SIGQUIT | 3 | Quits |
SIGILL | 4 | Illegal instruction |
SIGTRAP | 5 | Trace trap |
SIGABRT | 6 | Used by abort |
SIGEMT | 7 | EMT instruction |
SIGFPE | 8 | Floating-point exception |
SIGKILL | 9 | Kill (cannot be caught or ignored) |
SIGBUS | 10 | Bus error |
SIGSEGV | 11 | Segmentation violation |
SIGSYS | 12 | Bad argument to system call |
SIGPIPE | 13 | Writes on a pipe with no one to read it |
SIGALRM | 14 | Alarm clock |
SIGTERM | 15 | Software termination |
SIGUSR1 | 16 | User-defined signal 1 |
SIGUSR2 | 17 | User-defined signal 2 |
SIGCHLD | 18 | Child status change alias (POSIX) |
SIGPWR | 19 | Power-fail restart |
SIGWINCH | 20 | Window size change |
SIGURG | 21 | Urgent socket condition |
SIGPOLL /SIGIO | 22 | Pollable event occurred or Socket I/O possible |
SIGSTOP | 23 | Stop (cannot be caught or ignored) |
SIGTSTP | 24 | User stop requested from TTY |
SIGCONT | 25 | Stopped process has been continued |
SIGTTIN | 26 | Background TTY read attempted |
SIGTTOU | 27 | Background TTY write attempted |
SIGVTALRM | 28 | Virtual timer expired |
SIGPROF | 29 | Profiling timer expired |
SIGXCPU | 30 | Exceeded CPU limit |
SIGXFSZ | 31 | Exceeded file size limit |
SIGWAITING | 32 | Process' LWPs are blocked |
SIGLWP | 33 | Special signal used by thread library |
SIGFREEZE | 34 | Special signal used by CPR |
SIGTHAW | 35 | Special signal used by CPR |
SIGCANCEL | 36 | Thread cancellation signal used by libthread |
SIGLOST | 37 | Resource lost |
SIGRTMIN | 38 | Highest priority real-time signal |
SIGRTMAX | 45 | Lowest priority real-time signal |