Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

Section 10.2 Signal Concepts 317


The corefile will not be generated if (a) the process was set-user-ID and the current
user is not the owner of the program file, (b) the process was set-group-ID and the
current user is not the group owner of the file, (c) the user does not have permission to
write in the current working directory,(d) the file already exists and the user does not
have permission to write to it, or (e) the file is too big (recall theRLIMIT_CORElimit in
Section 7.11). The permissions of thecorefile (assuming that the file doesn’t already
exist) areusually user-read and user-write, although Mac OS X sets only user-read.
In Figure10.1, the signals with a description of ‘‘hardwarefault’’correspond to
implementation-defined hardwarefaults. Many of these names aretaken from the
original PDP-11 implementation of the UNIX System. Check your system’s manuals to
determine exactly which type of error these signals correspond to.
We now describe each of these signals in moredetail.
SIGABRT This signal is generated by calling theabortfunction (Section 10.17).
The process terminates abnormally.

SIGALRM This signal is generated when a timer set with the alarm function
expires (see Section 10.10 for moredetails). This signal is also generated
when an interval timer set by thesetitimer( 2 )function expires.
SIGBUS This signal indicates an implementation-defined hardwarefault.
Implementations usually generate this signal on certain types of memory
faults, as we describe in Section 14.8.

SIGCANCEL This signal is used internally by the Solaris threads library.It is not
meant for general use.
SIGCHLD Whenever a process terminates or stops, theSIGCHLDsignal is sent to
the parent. By default, this signal is ignored, so the parent must catch
this signal if it wants to be notified whenever a child’s status changes.
The normal action in the signal-catching function is to call one of the
waitfunctions to fetch the child’s process ID and termination status.
Earlier releases of System V had a similar signal namedSIGCLD(without
theH). The semantics of this signal weredifferent from those of other
signals, and as far back as SVR2, the manual page strongly discouraged
its use in new programs. (Strangely enough, this warning disappeared
in the SVR3 and SVR4 versions of the manual page.) Applications
should use the standard SIGCHLD signal, but be awarethat many
systems define SIGCLD to be the same as SIGCHLD for backward
compatibility.Ifyou maintain softwarethat usesSIGCLD,you need to
check your system’s manual page to see which semantics it follows. We
discuss these two signals in Section 10.7.
SIGCONT This job-control signal is sent to a stopped process when it is continued.
The default action is to continue a stopped process, but to ignorethe
signal if the process wasn’t stopped. Afull-screen editor,for example,
might catch this signal and use the signal handler to make a note to
redraw the terminal screen. See Section 10.21 for additional details.
Free download pdf