| <html lang="en"> |
| <head> |
| <title>Job Control Signals - The GNU C Library</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="The GNU C Library"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Standard-Signals.html#Standard-Signals" title="Standard Signals"> |
| <link rel="prev" href="Asynchronous-I_002fO-Signals.html#Asynchronous-I_002fO-Signals" title="Asynchronous I/O Signals"> |
| <link rel="next" href="Operation-Error-Signals.html#Operation-Error-Signals" title="Operation Error Signals"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU C library. |
| |
| This is Edition 0.12, last updated 2007-10-27, |
| of `The GNU C Library Reference Manual', for version |
| 2.8 (Sourcery G++ Lite 2011.03-41). |
| |
| Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, |
| 2003, 2007, 2008, 2010 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Free Software Needs Free Documentation'' |
| and ``GNU Lesser General Public License'', the Front-Cover texts being |
| ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A |
| copy of the license is included in the section entitled "GNU Free |
| Documentation License". |
| |
| (a) The FSF's Back-Cover Text is: ``You have the freedom to |
| copy and modify this GNU manual. Buying copies from the FSF |
| supports it in developing GNU and promoting software freedom.''--> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Job-Control-Signals"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Operation-Error-Signals.html#Operation-Error-Signals">Operation Error Signals</a>, |
| Previous: <a rel="previous" accesskey="p" href="Asynchronous-I_002fO-Signals.html#Asynchronous-I_002fO-Signals">Asynchronous I/O Signals</a>, |
| Up: <a rel="up" accesskey="u" href="Standard-Signals.html#Standard-Signals">Standard Signals</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">24.2.5 Job Control Signals</h4> |
| |
| <p><a name="index-job-control-signals-2873"></a> |
| These signals are used to support job control. If your system |
| doesn't support job control, then these macros are defined but the |
| signals themselves can't be raised or handled. |
| |
| <p>You should generally leave these signals alone unless you really |
| understand how job control works. See <a href="Job-Control.html#Job-Control">Job Control</a>. |
| |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| <div class="defun"> |
| — Macro: int <b>SIGCHLD</b><var><a name="index-SIGCHLD-2874"></a></var><br> |
| <blockquote><p><a name="index-child-process-signal-2875"></a>This signal is sent to a parent process whenever one of its child |
| processes terminates or stops. |
| |
| <p>The default action for this signal is to ignore it. If you establish a |
| handler for this signal while there are child processes that have |
| terminated but not reported their status via <code>wait</code> or |
| <code>waitpid</code> (see <a href="Process-Completion.html#Process-Completion">Process Completion</a>), whether your new handler |
| applies to those processes or not depends on the particular operating |
| system. |
| </p></blockquote></div> |
| |
| <!-- signal.h --> |
| <!-- SVID --> |
| <div class="defun"> |
| — Macro: int <b>SIGCLD</b><var><a name="index-SIGCLD-2876"></a></var><br> |
| <blockquote><p>This is an obsolete name for <code>SIGCHLD</code>. |
| </p></blockquote></div> |
| |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| <div class="defun"> |
| — Macro: int <b>SIGCONT</b><var><a name="index-SIGCONT-2877"></a></var><br> |
| <blockquote><p><a name="index-continue-signal-2878"></a>You can send a <code>SIGCONT</code> signal to a process to make it continue. |
| This signal is special—it always makes the process continue if it is |
| stopped, before the signal is delivered. The default behavior is to do |
| nothing else. You cannot block this signal. You can set a handler, but |
| <code>SIGCONT</code> always makes the process continue regardless. |
| |
| <p>Most programs have no reason to handle <code>SIGCONT</code>; they simply |
| resume execution without realizing they were ever stopped. You can use |
| a handler for <code>SIGCONT</code> to make a program do something special when |
| it is stopped and continued—for example, to reprint a prompt when it |
| is suspended while waiting for input. |
| </p></blockquote></div> |
| |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| <div class="defun"> |
| — Macro: int <b>SIGSTOP</b><var><a name="index-SIGSTOP-2879"></a></var><br> |
| <blockquote><p>The <code>SIGSTOP</code> signal stops the process. It cannot be handled, |
| ignored, or blocked. |
| </p></blockquote></div> |
| <a name="index-stop-signal-2880"></a> |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| |
| <div class="defun"> |
| — Macro: int <b>SIGTSTP</b><var><a name="index-SIGTSTP-2881"></a></var><br> |
| <blockquote><p>The <code>SIGTSTP</code> signal is an interactive stop signal. Unlike |
| <code>SIGSTOP</code>, this signal can be handled and ignored. |
| |
| <p>Your program should handle this signal if you have a special need to |
| leave files or system tables in a secure state when a process is |
| stopped. For example, programs that turn off echoing should handle |
| <code>SIGTSTP</code> so they can turn echoing back on before stopping. |
| |
| <p>This signal is generated when the user types the SUSP character |
| (normally <kbd>C-z</kbd>). For more information about terminal driver |
| support, see <a href="Special-Characters.html#Special-Characters">Special Characters</a>. |
| </p></blockquote></div> |
| <a name="index-interactive-stop-signal-2882"></a> |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| |
| <div class="defun"> |
| — Macro: int <b>SIGTTIN</b><var><a name="index-SIGTTIN-2883"></a></var><br> |
| <blockquote><p>A process cannot read from the user's terminal while it is running |
| as a background job. When any process in a background job tries to |
| read from the terminal, all of the processes in the job are sent a |
| <code>SIGTTIN</code> signal. The default action for this signal is to |
| stop the process. For more information about how this interacts with |
| the terminal driver, see <a href="Access-to-the-Terminal.html#Access-to-the-Terminal">Access to the Terminal</a>. |
| </p></blockquote></div> |
| <a name="index-terminal-input-signal-2884"></a> |
| <!-- signal.h --> |
| <!-- POSIX.1 --> |
| |
| <div class="defun"> |
| — Macro: int <b>SIGTTOU</b><var><a name="index-SIGTTOU-2885"></a></var><br> |
| <blockquote><p>This is similar to <code>SIGTTIN</code>, but is generated when a process in a |
| background job attempts to write to the terminal or set its modes. |
| Again, the default action is to stop the process. <code>SIGTTOU</code> is |
| only generated for an attempt to write to the terminal if the |
| <code>TOSTOP</code> output mode is set; see <a href="Output-Modes.html#Output-Modes">Output Modes</a>. |
| </p></blockquote></div> |
| <a name="index-terminal-output-signal-2886"></a> |
| While a process is stopped, no more signals can be delivered to it until |
| it is continued, except <code>SIGKILL</code> signals and (obviously) |
| <code>SIGCONT</code> signals. The signals are marked as pending, but not |
| delivered until the process is continued. The <code>SIGKILL</code> signal |
| always causes termination of the process and can't be blocked, handled |
| or ignored. You can ignore <code>SIGCONT</code>, but it always causes the |
| process to be continued anyway if it is stopped. Sending a |
| <code>SIGCONT</code> signal to a process causes any pending stop signals for |
| that process to be discarded. Likewise, any pending <code>SIGCONT</code> |
| signals for a process are discarded when it receives a stop signal. |
| |
| <p>When a process in an orphaned process group (see <a href="Orphaned-Process-Groups.html#Orphaned-Process-Groups">Orphaned Process Groups</a>) receives a <code>SIGTSTP</code>, <code>SIGTTIN</code>, or <code>SIGTTOU</code> |
| signal and does not handle it, the process does not stop. Stopping the |
| process would probably not be very useful, since there is no shell |
| program that will notice it stop and allow the user to continue it. |
| What happens instead depends on the operating system you are using. |
| Some systems may do nothing; others may deliver another signal instead, |
| such as <code>SIGKILL</code> or <code>SIGHUP</code>. In the GNU system, the process |
| dies with <code>SIGKILL</code>; this avoids the problem of many stopped, |
| orphaned processes lying around the system. |
| |
| </body></html> |
| |