Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

Section 10.2 Signal Concepts 321


SIGTERM This is the termination signal sent by thekill( 1 )command by default.
Because it can be caught by applications, usingSIGTERMgives programs
achance to terminate gracefully by cleaning up beforeexiting (in
contrast toSIGKILL,which can’t be caught or ignored).
SIGTHAW This signal is defined only by Solaris and is used to notify processes that
need to take special action when the system resumes operation after
being suspended.

SIGTHR This is a signal reserved for use by the thread library on FreeBSD. It is
defined to have the same value asSIGLWP.
SIGTRAP This signal indicates an implementation-defined hardwarefault.

The signal name comes from the PDP-11 TRAP instruction. Implementations
often use this signal to transfer control to a debugger when a breakpoint
instruction is executed.

SIGTSTP This interactive stop signal is generated by the terminal driver when we
press the terminal suspend key (often Control-Z). This signal is sent to
all processes in the foreground process group (refer to Figure9.9).

Unfortunately,the termstophas different meanings. When discussing job
control and signals, we talk about stopping and continuing jobs. The terminal
driver,however,has historically used the termstopto refer to stopping and
starting the terminal output using the Control-Sand Control-Qcharacters.
Therefore, the terminal driver calls the character that generates the interactive
stop signal the suspend character,not the stop character.

SIGTTIN This signal is generated by the terminal driver when a process in a
background process group tries to read from its controlling terminal.
(Refer to the discussion of this topic in Section 9.8.) As special cases, if
either (a) the reading process is ignoring or blocking this signal or (b) the
process group of the reading process is orphaned, then the signal is not
generated; instead, the read operation fails witherrnoset toEIO.

SIGTTOU This signal is generated by the terminal driver when a process in a
background process group tries to write to its controlling terminal. (This
is discussed in Section 9.8.) Unlike the case with background reads, a
process can choose to allow background writes to the controlling
terminal. Wedescribe how to modify this option in Chapter 18.
If background writes arenot allowed, then like the SIGTTINsignal,
thereare two special cases: if either (a) the writing process is ignoring or
blocking this signal or (b) the process group of the writing process is
orphaned, then the signal is not generated; instead, the write operation
returns an error witherrnoset toEIO.
Regardless of whether background writes areallowed, certain terminal
operations (other than writing) can also generate theSIGTTOUsignal.
Free download pdf