signal man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

signal(2)							     signal(2)

NAME
       signal(),  sigset(),  sighold(),	 sigrelse(), sigignore(), sigpause() -
       signal management

SYNOPSIS
DESCRIPTION
       The functions described in this reference page provide simplified  sig‐
       nal management:

       ·  The  function chooses one of three ways in which receipt of the sig‐
	  nal number sig is to be subsequently handled.

       ·  The function is used to modify signal dispositions.

       ·  The function adds sig to the calling process' signal mask.

       ·  The function removes sig from the calling process' signal mask.

       ·  The function sets the disposition of sig to

       ·  The function removes sig from the calling process' signal  mask  and
	  suspends the calling process until a signal is received.

       The system defines a set of signals that can be delivered to a process.
       The set of signals is defined in signal(5), along with the meaning  and
       side effects of each signal.  An alternate mechanism for handling these
       signals is defined here.	 The facilities described here should  not  be
       used  in	 conjunction  with  the	 other facilities described under sig‐
       nal(2), sigvector(2),  sigblock(2),  sigsetmask(2),  sigpause(3C),  and
       sigspace(2).

       The  function  chooses one of three ways in which receipt of the signal
       number sig is to be subsequently handled.  If  the  value  of  func  is
       default	handling  for that signal will occur.  If the value of func is
       the signal will be ignored.  Otherwise, func must point to  a  function
       to be called when that signal occurs.  Such a function is called a sig‐
       nal handler.

       When a signal occurs, if func points to a function, first  the  equiva‐
       lent of:

       is  executed  or	 an implementation-dependent blocking of the signal is
       performed.  (If the value of sig is whether  the	 reset	to  occurs  is
       implementation-dependent.)  Next the equivalent of:

       is  executed.   The  func  function may terminate by executing a return
       statement or by calling or If executes a return statement and the value
       of sig was or any other implementation-dependent value corresponding to
       a computational exception, the behavior is undefined.   Otherwise,  the
       program will resume execution at the point it was interrupted.

       If  the signal occurs other than as the result of calling or the behav‐
       ior is undefined if the signal handler calls any function in the	 stan‐
       dard   library	other	than  one  of  the  functions  listed  on  the
       thread_safety(5) manpage or refers to any object	 with  static  storage
       duration	 other	than by assigning a value to a static storage duration
       variable of type volatile sig_atomic_t.	Furthermore, if	 such  a  call
       fails, the value of is indeterminate.

       At program startup, the equivalent of:

       is executed for some signals, and the equivalent of:

       is executed for all other signals (see

       Acceptable values for sig are described in signal(5).

       Acceptable values for func are:

	      Execute  the  default action, which varies depending on the sig‐
	      nal.
			  The default action for most signals is to  terminate
			  the process (see signal(5)).

			  A  pending signal is discarded (whether or not it is
			  blocked) if action is set to but the default	action
			  of the pending signal is to ignore the signal (as in
			  the case of

	      Ignore the signal.

			  When is called with action set to and an instance of
			  the  signal  sig  is	pending, the pending signal is
			  discarded, whether or not it is blocked.

			  and signals cannot be ignored.

	      address	  Catch the signal.

			  Upon receipt of  signal  sig,	 reset	the  value  of
			  action  for  the  caught  signal  to (except signals
			  marked with "not reset when caught"; see signal(5)),
			  call	the  signal-catching function to which address
			  points, and resume executing the  receiving  process
			  at the point where it was interrupted.

			  In  HP-UX,  the  signal-catching  function is called
			  with the following three parameters:

			       sig     The signal number.

			       code    A word of information usually  provided
				       by the hardware.

			       scp     A   pointer  to	the  machine-dependent
				       structure sigcontext defined in

			  The pointer scp is valid only during the context  of
			  the signal-catching function.	 The structure pointer
			  scp is always defined.

			  The code word is always zero for all signals	except
			  and For code has the following values:

			       illegal instruction trap;
			       break instruction trap;
			       privileged operation trap;
			       privileged register trap.

			  For code has the following values:

			       overflow trap;
			       conditional trap;
			       assist exception trap;
			       assist emulation trap.

			  As  defined  by  the IEEE POSIX Standard, HP-UX does
			  not raise an exception on floating-point  divide  by
			  zero.	  The  result of floating-point divide by zero
			  is infinity which can be checked by

			  The signals and cannot be caught.

       The function is used to modify signal dispositions.

       The sig argument specifies the signal, which may be any	signal	except
       and

       The  disp  argument specifies the signal's disposition, which may be or
       the address of a signal handler.

       If disp is the address of a signal handler, the system will add sig  to
       the  calling  process' signal mask before executing the signal handler.
       When the signal handler returns, the system will	 restore  the  calling
       process' signal mask to its state prior to the delivery of the signal.

       If  disp	 is  equal to sig will be added to the calling process' signal
       mask and sig's disposition will remain unchanged.

       If disp is not equal to sig will be removed from the  calling  process'
       signal mask.

       If disp is not or it must be a pointer to a function, the signal-catch‐
       ing handler, that is called when signal sig occurs.  Before calling the
       signal-catching	handler, the system signal action of sig is set to Any
       pending signal of this type  is	released.   This  handler  address  is
       retained	 across	 calls to the other signal management functions listed
       here.  Upon receipt of signal sig, the receiving process	 executes  the
       signal-catching handler pointed to by disp.

       During  a  normal  return  from the signal-catching handler, the system
       signal action is restored to disp and any held signal of this  type  is
       released.   If a non-local goto is taken, must be called to restore the
       system signal action to disp and release any held signal of this type.

       For either or if the action for the signal is set to child processes of
       the  calling  processes	will  not be transformed into zombie processes
       when they terminate.  If the calling process subsequently waits for its
       children, and the process has no unwaited for children that were trans‐
       formed into zombie processes, it will block until all of	 its  children
       terminate, and and will fail and set to

RETURN VALUE
       If the request can be honored, returns the value of for the most recent
       call to for the specified signal sig.  Otherwise,  is  returned	and  a
       positive value is stored in

       Upon  successful completion, returns if the signal had been blocked and
       the signal's previous disposition if it had not been  blocked.	Other‐
       wise, is returned and is set to indicate the error.

       For  all	 other	functions,  upon successful completion, 0 is returned.
       Otherwise, −1 is returned and is set to indicate the error.

ERRORS
       The function will fail if:

	      The	     sig argument is not a valid signal number	or  an
			     attempt  is made to catch a signal that cannot be
			     caught or ignore a signal that cannot be ignored.

       The function may fail if:

	      An attempt was made to set the action to
			     for a signal that cannot be caught or ignored (or
			     both).

       The function will fail if:

	      The	     func  argument  points  to	 memory	 that is not a
			     valid part of the process address	space.	 Reli‐
			     able  detection  of this error is implementation-
			     dependent.

	      The	     sig argument is an illegal signal number.

	      An attempt is made to ignore, hold, or supply a handler
			     for a signal that cannot  be  ignored,  held,  or
			     caught; see signal(5).

       The and functions will fail if:

	      The	     sig argument is an illegal signal number.

	      An attempt is made to ignore, hold, or supply a handler
			     for  a  signal  that  cannot be ignored, held, or
			     caught; see signal(5).

       The returns when the following occurs:

	      A signal was caught.

APPLICATION USAGE
       The function provides a more comprehensive and reliable	mechanism  for
       controlling signals; new applications should use rather than

       The  function, in conjunction with or may be used to establish critical
       regions of code that require the delivery of a signal to be temporarily
       deferred.

       The function should be used in preference to for broader portability.

       The  function  suspends	the  calling  process  until  it  receives  an
       unblocked signal.  If the signal sig is held, it is released before the
       process	pauses.	 is useful for testing variables that are changed when
       a signal occurs.	 For example, should  be  used	to  block  the	signal
       first, then test the variables.	If they have not changed, call to wait
       for the signal.

   Threads Considerations
       The signal disposition (such as catch/ignore/default) established by is
       shared  by  all threads in the process.	Blocked signal masks are main‐
       tained by each thread.

       The use of this function is unspecified in a multithreaded process.

       For more information regarding signals and threads, refer to signal(5).

EXAMPLES
       The following call to sets up a signal-catching function for  the  sig‐
       nal:

WARNINGS
       should  not  be used in conjunction with the facilities described under
       bsdproc(3C), sigaction(2), sigset(3C), or sigvector(2).

       does not detect an invalid value for action, and if it does  not	 equal
       or or point to a valid function address, subsequent receipt of the sig‐
       nal sig causes undefined results.

AUTHOR
       was developed by HP, AT&T, and the University of California, Berkeley.

SEE ALSO
       kill(1),	 init(1M),  exec(2),  exit(2),	kill(2),  lseek(2),  pause(2),
       sigaction(2),  sigvector(2), wait(2), waitid(2), abort(3C), setjmp(3C),
       signal(5).

STANDARDS CONFORMANCE
								     signal(2)
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net