• Main Menu
  • Unix Signals


    A signal is a message that can be sent to a running process.

    Programs, users, or administrators can initiate signals.

    For example, the proper method of telling the Internet Daemon (inetd) to re-read its configuration file is to send it a SIGHUP signal.

    For example, if the current process ID (PID) of inetd is 4140, type:

    kill -SIGHUP 4140

    Another common use of signals is to stop a running process. To stop the inetd process completely, use this command:

    kill 4140

    By default, the kill command sends the SIGTERM signal. If SIGTERM fails, escalate to using the SIGKILL signal to stop the process:

    kill -9 4140

    Because SIGKILL cannot be handled, stopping a process with SIGKILL is generally considered a bad idea. Using SIGKILL prevents a process from cleaning up after itself and exiting gracefully.

    Handling Signals

    Each Unix signal has a default set of effects on a Unix program. Programmers can code their applications to respond in customized ways to most signals. These custom code pieces are called signal handlers.

    A signal handler is unable to redefine two signals. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. A signal handler cannot “catch” these two signals.

    FreeBSD Signals

    Signal NameSignal NumberSignal Description
    SIGHUP1Terminal line hangup
    SIGINT2Interrupt program
    SIGQUIT3Quit program
    SIGILL4Illegal instruction
    SIGTRAP5Trace trap
    SIGABRT6Abort
    SIGEMT7Emulate instruction executed
    SIGFPE8Floating-point exception
    SIGKILL9Kill program
    SIGBUS10Bus error
    SIGSEGV11Segmentation violation
    SIGSYS12Bad argument to system call
    SIGPIPE13Write on a pipe with no one to read it
    SIGALRM14Real-time timer expired
    SIGTERM15Software termination signal
    SIGURG16Urgent condition on I/O channel
    SIGSTOP17Stop signal not from terminal
    SIGTSTP18Stop signal from terminal
    SIGCONT19A stopped process is being continued
    SIGCHLD20Notification to parent on child stop or exit
    SIGTTIN21Read on terminal by background process
    SIGTTOU22Write to terminal by background process
    SIGIO23I/O possible on a descriptor
    SIGXCPU24CPU time limit exceeded
    SIGXFSZ25File-size limit exceeded
    SIGVTALRM26Virtual timer expired
    SIGPROF27Profiling timer expired
    SIGWINCH28Window size changed
    SIGINFO29Information request
    SIGUSR130User-defined signal 1
    SIGUSR231User-defined signal 2
    SIGTHR32Thread interrupt

    Solaris Signals

    Signal NameSignal NumberSignal Description
    SIGHUP1Hangs up
    SIGINT2Interrupts
    SIGQUIT3Quits
    SIGILL4Illegal instruction
    SIGTRAP5Trace trap
    SIGABRT6Used by abort
    SIGEMT7EMT instruction
    SIGFPE8Floating-point exception
    SIGKILL9Kill (cannot be caught or ignored)
    SIGBUS10Bus error
    SIGSEGV11Segmentation violation
    SIGSYS12Bad argument to system call
    SIGPIPE13Writes on a pipe with no one to read it
    SIGALRM14Alarm clock
    SIGTERM15Software termination
    SIGUSR116User-defined signal 1
    SIGUSR217User-defined signal 2
    SIGCHLD18Child status change alias (POSIX)
    SIGPWR19Power-fail restart
    SIGWINCH20Window size change
    SIGURG21Urgent socket condition
    SIGPOLL /SIGIO22Pollable event occurred or Socket I/O possible
    SIGSTOP23Stop (cannot be caught or ignored)
    SIGTSTP24User stop requested from TTY
    SIGCONT25Stopped process has been continued
    SIGTTIN26Background TTY read attempted
    SIGTTOU27Background TTY write attempted
    SIGVTALRM28Virtual timer expired
    SIGPROF29Profiling timer expired
    SIGXCPU30Exceeded CPU limit
    SIGXFSZ31Exceeded file size limit
    SIGWAITING32Process’ LWPs are blocked
    SIGLWP33Special signal used by thread library
    SIGFREEZE34Special signal used by CPR
    SIGTHAW35Special signal used by CPR
    SIGCANCEL36Thread cancellation signal used by libthread
    SIGLOST37Resource lost
    SIGRTMIN38Highest priority real-time signal
    SIGRTMAX45Lowest priority real-time signal
    • eric

      this was very helpful. finally, information when you ask for it with a simple search

    Unix