home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3b / sigvec.z / sigvec
Encoding:
Text File  |  2002-10-03  |  11.1 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))                                                          SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      sigvec - 4.3BSD software signal facilities
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssiiiiggggnnnnaaaallll....hhhh>>>>
  13.  
  14.      ssssttttrrrruuuucccctttt ssssiiiiggggvvvveeeecccc {{{{
  15.           iiiinnnntttt  ((((****ssssvvvv____hhhhaaaannnnddddlllleeeerrrr))))((((iiiinnnntttt,,,, iiiinnnntttt))));;;;
  16.           iiiinnnntttt  ssssvvvv____mmmmaaaasssskkkk;;;;
  17.           iiiinnnntttt  ssssvvvv____ffffllllaaaaggggssss;;;;
  18.      }}}};;;;
  19.  
  20.      iiiinnnntttt ssssiiiiggggvvvveeeecccc((((iiiinnnntttt ssssiiiigggg,,,, ssssttttrrrruuuucccctttt ssssiiiiggggvvvveeeecccc ****vvvveeeecccc,,,, ssssttttrrrruuuucccctttt ssssiiiiggggvvvveeeecccc ****oooovvvveeeecccc))));;;;
  21.  
  22.      To use any of the BSD signal routines (_k_i_l_l(3B), _k_i_l_l_p_g(3B),
  23.      _s_i_g_b_l_o_c_k(3B), _s_i_g_n_a_l(3B), _s_i_g_p_a_u_s_e(3B), _s_i_g_s_e_t_m_a_s_k(3B), _s_i_g_s_t_a_c_k(2B),
  24.      _s_i_g_v_e_c(3B)) you must either
  25.  
  26.      1) #define ____BBBBSSSSDDDD____SSSSIIIIGGGGNNNNAAAALLLLSSSS or ____BBBBSSSSDDDD____CCCCOOOOMMMMPPPPAAAATTTT before including <_s_i_g_n_a_l._h>, or
  27.  
  28.      2) specify one of them in the compile command or makefile:
  29.  
  30.           cc -D_BSD_SIGNALS -o prog prog.c
  31.  
  32.  
  33. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  34.      _s_i_g_v_e_c specifies and reports on the way individual signals are to be
  35.      handled in the calling process.  If _v_e_c is non-zero, it alters the way
  36.      the signal will be treated - default behavior, ignored, or handled via a
  37.      routine - and the signal mask to be used when delivering the signal if a
  38.      handler is installed.  If _o_v_e_c is non-zero, the previous handling
  39.      information for the signal is returned to the user.  In this way (a NULL
  40.      _v_e_c and a non-NULL _o_v_e_c) the user can inquire as to the current handling
  41.      of a signal without changing it.  If both _v_e_c and _o_v_e_c are NULL, _s_i_g_v_e_c
  42.      will return -1 and set _e_r_r_n_o to EEEEIIIINNNNVVVVAAAALLLL if _s_i_g is an invalid signal (else
  43.      0), allowing an application to dynamically determine the set of signals
  44.      supported by the system.
  45.  
  46.      The system defines a set of signals that may be delivered to a process.
  47.      Signal delivery resembles the occurrence of a hardware interrupt:  the
  48.      signal is blocked from further occurrence, the current process context is
  49.      saved, and a new one is built.  A process may specify a _h_a_n_d_l_e_r to which
  50.      a signal is delivered, or specify that a signal is to be _b_l_o_c_k_e_d or
  51.      _i_g_n_o_r_e_d.  A process may also specify that a default action is to be taken
  52.      by the system when a signal occurs.
  53.  
  54.      All signals have the same _p_r_i_o_r_i_t_y.  Signal routines execute with the
  55.      signal that caused their invocation _b_l_o_c_k_e_d, but other signals may yet
  56.      occur.  A global _s_i_g_n_a_l _m_a_s_k defines the set of signals currently blocked
  57.      from delivery to a process.  The signal mask for a process is initialized
  58.      from that of its parent (normally 0).  It may be changed with a
  59.      _s_i_g_b_l_o_c_k(3B) or _s_i_g_s_e_t_m_a_s_k(3B) call, or when a signal is delivered to the
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))                                                          SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))
  71.  
  72.  
  73.  
  74.      process.
  75.  
  76.      When a signal condition arises for a process, the signal is added to a
  77.      set of signals pending for the process.  If the signal is not currently
  78.      _b_l_o_c_k_e_d by the process then it is delivered to the process.  When a
  79.      signal is delivered, the current state of the process is saved, a new
  80.      signal mask is calculated (as described below), and the signal handler is
  81.      invoked.  The call to the handler is arranged so that if the signal
  82.      handling routine returns normally the process will resume execution in
  83.      the context from before the signal's delivery.  If the process wishes to
  84.      resume in a different context, then it must arrange to restore the
  85.      previous context itself.
  86.  
  87.      When a signal is delivered to a process a new signal mask is installed
  88.      for the duration of the process' signal handler (or until a _s_i_g_b_l_o_c_k or
  89.      _s_i_g_s_e_t_m_a_s_k call is made).  This mask is formed by taking the current
  90.      signal mask, adding the signal to be delivered, and _o_r'ing in the signal
  91.      mask associated with the handler to be invoked.
  92.  
  93.      _S_i_g_v_e_c assigns a handler for a specific signal.  If _v_e_c is non-zero, it
  94.      specifies a handler routine and mask to be used when delivering the
  95.      specified signal.  Further, if the SV_ONSTACK bit is set in _s_v__f_l_a_g_s, the
  96.      system will deliver the signal to the process on a _s_i_g_n_a_l _s_t_a_c_k,
  97.      specified with _s_i_g_s_t_a_c_k(2b).
  98.  
  99.      For a list of valid signal numbers and a general description of the
  100.      signal mechanism, please see _ssss_iiii_gggg_nnnn_aaaa_llll(5).
  101.  
  102.      Once a signal handler is installed, it remains installed until another
  103.      _s_i_g_v_e_c call is made, or an _e_x_e_c_v_e(2) is performed.  The default action
  104.      for a signal may be reinstated by setting _s_v__h_a_n_d_l_e_r to SSSSIIIIGGGG____DDDDFFFFLLLL; this
  105.      default is termination with a core image for signals marked [[[[1111]]]].  If
  106.      _s_v__h_a_n_d_l_e_r is SSSSIIIIGGGG____IIIIGGGGNNNN the signal is subsequently ignored, and pending
  107.      instances of the signal are discarded.
  108.  
  109.      SSSSIIIIGGGGKKKKIIIILLLLLLLL will immediately terminate a process, regardless of its state.
  110.      Processes which are stopped via job control (typically <ctrl>-Z) will not
  111.      act upon any delivered signals other than SSSSIIIIGGGGKKKKIIIILLLLLLLL until the job is
  112.      restarted.  Processes which are blocked via a _b_l_o_c_k_p_r_o_c(2) system call
  113.      will unblock if they receive a signal which is fatal (i.e., a non-job-
  114.      control signal which they are NOT catching), but will still be stopped if
  115.      the job of which they are a part is stopped.  Only upon restart will they
  116.      die.  Any non-fatal signals received by a blocked process will NOT cause
  117.      the process to be unblocked (a call to _u_n_b_l_o_c_k_p_r_o_c(2) or
  118.      _u_n_b_l_o_c_k_p_r_o_c_a_l_l(2) is necessary).
  119.  
  120.      After a _f_o_r_k(2) the child inherits all handlers, the signal stack and the
  121.      signal masks, but not the set of the pending signals.
  122.  
  123.      The _e_x_e_c(2) routines reset all caught signals to default action , clear
  124.      all handler masks and reset all signals to be caught on the user stack.
  125.      Ignored signals remain ignored; the blocked signal mask is unchanged and
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))                                                          SSSSIIIIGGGGVVVVEEEECCCC((((3333BBBB))))
  137.  
  138.  
  139.  
  140.      pending signals remain pending.
  141.  
  142.      The mask specified in _v_e_c is not allowed to block SSSSIIIIGGGGKKKKIIIILLLLLLLL, SSSSIIIIGGGGSSSSTTTTOOOOPPPP, or
  143.      SSSSIIIIGGGGCCCCOOOONNNNTTTT.  This is enforced silently by the system.
  144.  
  145. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  146.      A 0 value indicated that the call succeeded.  A -1 return value indicates
  147.      an error occurred and _e_r_r_n_o is set to indicate the reason.
  148.  
  149. EEEERRRRRRRROOOORRRRSSSS
  150.      _s_i_g_v_e_c is a library routine (executing in user space): if either _v_e_c or
  151.      _o_v_e_c points to memory that is not a valid part of the process address
  152.      space, the process will receive a memory fault (SSSSIIIIGGGGSSSSEEEEGGGGVVVV) signal and
  153.      terminate (unless it has installed a handler for SSSSIIIIGGGGSSSSEEEEGGGGVVVV).  If the
  154.      invalid pointer is the result of using a REFERENCE instead of a POINTER,
  155.      the compiler will issue a warning.
  156.  
  157.      _s_i_g_v_e_c will fail and no new signal handler will be installed if one of
  158.      the following occurs:
  159.  
  160.      [EINVAL]       _S_i_g is not a valid signal number.
  161.  
  162.      [EINVAL]       An attempt is made to ignore or supply a handler for
  163.                     SSSSIIIIGGGGKKKKIIIILLLLLLLL or SSSSIIIIGGGGSSSSTTTTOOOOPPPP.
  164.  
  165.      [EINVAL]       An attempt is made to ignore SSSSIIIIGGGGCCCCOOOONNNNTTTT (by default SSSSIIIIGGGGCCCCOOOONNNNTTTT
  166.                     is ignored).
  167.  
  168. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  169.      kill(3B), sigblock(3B), sigsetmask(3B), sigpause(3B), sigvec(3B),
  170.      setjmp(3), blockproc(2), signal(5).
  171.  
  172. CCCCAAAAVVVVEEEEAAAATTTTSSSS ((((IIIIRRRRIIIIXXXX))))
  173.      4.2BSD attempts to restart system calls which are interrupted by signal
  174.      receipt; 4.3BSD gives the programmer a choice of restart or failed-
  175.      return-with-error via the SSSSVVVV____IIIINNNNTTTTEEEERRRRRRRRUUUUPPPPTTTT flag in _s_i_g_v_e_c or use of the
  176.      _s_i_g_i_n_t_e_r_r_u_p_t library routine.  IRIX provides _o_n_l_y the fail-with-error
  177.      option.  The affected system calls are _r_e_a_d(2), _w_r_i_t_e(2), _o_p_e_n(2),
  178.      _i_o_c_t_l(2), and _w_a_i_t(2).  Refer to the _s_i_g_s_e_t(2) man page for more a
  179.      detailed description of the behavior.
  180.  
  181. WWWWAAAARRRRNNNNIIIINNNNGGGG ((((IIIIRRRRIIIIXXXX))))
  182.      The 4.3BSD and System V signal facilities have different semantics.
  183.      Using both facilities in the same program is ssssttttrrrroooonnnnggggllllyyyy ddddiiiissssccccoooouuuurrrraaaaggggeeeedddd and
  184.      will result in unpredictable behavior.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.