home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat3 / signal.0 < prev    next >
Text File  |  1993-12-07  |  7KB  |  133 lines

  1.  
  2. SIGNAL(3)                  UNIX Programmer's Manual                  SIGNAL(3)
  3.  
  4. NNAAMMEE
  5.      ssiiggnnaall - simplified software signal facilities
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssiiggnnaall..hh>>
  9.  
  10.      _v_o_i_d
  11.      **ssiiggnnaall(_s_i_g, _f_u_n_c)()
  12.  
  13.      _v_o_i_d
  14.      (**ffuunncc)()
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      This ssiiggnnaall() facility is a simplified interface to the more general
  18.      sigaction(2) facility.
  19.  
  20.      Signals allow the manipulation of a process from outside its domain as
  21.      well as allowing the process to manipulate itself or copies of itself
  22.      (children). There are two general types of signals: those that cause ter­
  23.      mination of a process and those that do not.  Signals which cause termi­
  24.      nation of a program might result from an irrecoverable error or might be
  25.      the result of a user at a terminal typing the `interrupt' character.
  26.      Signals are used when a process is stopped because it wishes to access
  27.      its control terminal while in the background (see tty(4)).  Signals are
  28.      optionally generated when a process resumes after being stopped, when the
  29.      status of child processes changes, or when input is ready at the control
  30.      terminal.  Most signals result in the termination of the process receiv­
  31.      ing them if no action is taken; some signals instead cause the process
  32.      receiving them to be stopped, or are simply discarded if the process has
  33.      not requested otherwise.  Except for the SIGKILL and SIGSTOP signals, the
  34.      ssiiggnnaall() function allows for a signal to be caught, to be ignored, or to
  35.      generate an interupt.  These signals are defined in the file <_s_i_g_n_a_l_._h>:
  36.  
  37.      NNaammee              DDeeffaauulltt AAccttiioonn                      DDeessccrriippttiioonn
  38.      SIGHUP          terminate process       terminal line hangup
  39.      SIGINT          terminate process       interrupt program
  40.      SIGQUIT         create core image       quit program
  41.      SIGILL          create core image       illegal instruction
  42.      SIGTRAP         create core image       trace trap
  43.      SIGABRT         create core image       abort(2) call (formerly SIGIOT)
  44.      SIGEMT          create core image       emulate instruction executed
  45.      SIGFPE          create core image       floating­point exception
  46.      SIGKILL         terminate process       kill program
  47.      SIGBUS          create core image       bus error
  48.      SIGSEGV         create core image       segmentation violation
  49.      SIGSYS          create core image       system call given invalid
  50.                                              argument
  51.      SIGPIPE         terminate process       write on a pipe with no reader
  52.      SIGALRM         terminate process       real­time timer expired
  53.      SIGTERM         terminate process       software termination signal
  54.      SIGURG          discard signal          urgent condition present on
  55.                                              socket
  56.      SIGSTOP         stop process            stop (cannot be caught or
  57.                                              ignored)
  58.      SIGTSTP         stop process            stop signal generated from
  59.                                              keyboard
  60.      SIGCONT         discard signal          continue after stop
  61.      SIGCHLD         discard signal          child status has changed
  62.      SIGTTIN         stop process            background read attempted from
  63.                                              control terminal
  64.      SIGTTOU         stop process            background write attempted to
  65.  
  66.                                              control terminal
  67.      SIGIO           discard signal          I/O is possible on a descriptor
  68.                                              (see fcntl(2))
  69.      SIGXCPU         terminate process       cpu time limit exceeded (see
  70.                                              setrlimit(2))
  71.      SIGXFSZ         terminate process       file size limit exceeded (see
  72.                                              setrlimit(2))
  73.      SIGVTALRM       terminate process       virtual time alarm (see
  74.                                              setitimer(2))
  75.      SIGPROF         terminate process       profiling timer alarm (see
  76.                                              setitimer(2))
  77.      SIGWINCH        discard signal          Window size change
  78.      SIGINFO         discard signal          status request from keyboard
  79.      SIGUSR1         terminate process       User defined signal 1
  80.      SIGUSR2         terminate process       User defined signal 2
  81.  
  82.      The _f_u_n_c procedure allows a user to choose the action upon receipt of a
  83.      signal.  To set the default action of the signal to occur as listed
  84.      above, _f_u_n_c should be SIG_DFL. A SIG_DFL resets the default action.  To
  85.      ignore the signal _f_u_n_c should be SIG_IGN. This will cause subsequent in­
  86.      stances of the signal to be ignored and pending instances to be discard­
  87.      ed. If SIG_IGN is not used, further occurrences of the signal are auto­
  88.      matically blocked and _f_u_n_c is called.
  89.  
  90.      The handled signal is unblocked with the function returns and the process
  91.      continues from where it left off when the signal occured.  UUnnlliikkee pprreevvii­­
  92.      oouuss ssiiggnnaall ffaacciilliittiieess,, tthhee hhaannddlleerr ffuunncc(()) rreemmaaiinnss iinnssttaalllleedd aafftteerr aa ssiigg­­
  93.      nnaall hhaass bbeeeenn ddeelliivveerreedd..
  94.  
  95.      For some system calls, if a signal is caught while the call is executing
  96.      and the call is permaturely terminated, the call is automatically
  97.      restarted.  (The handler is installed using the SA_RESTART flag with
  98.      sigaction(2).)  The affected system calls include read(2),  write(2),
  99.      sendto(2),  recvfrom(2),  sendmsg(2) and recvmsg(2) on a communications
  100.      channel or a low speed device and during a ioctl(2) or wait(2).  However,
  101.      calls that have already committed are not restarted, but instead return a
  102.      partial success (for example, a short read count).
  103.  
  104.      When a process which has installed signal handlers forks, the child pro­
  105.      cess inherits the signals.  All caught signals may be reset to their de­
  106.      fault action by a call to the execve(2) function; ignored signals remain
  107.      ignored.
  108.  
  109. RREETTUURRNN VVAALLUUEESS
  110.      The previous action is returned on a successful call.  Otherwise, -1 is
  111.      returned and  the global variable _e_r_r_n_o is set to indicate the error.
  112.  
  113. EERRRROORRSS
  114.      Signal will fail and no action will take place if one of the following
  115.      occur:
  116.  
  117.      [EINVAL]  _S_i_g is not a valid signal number.
  118.  
  119.      [EINVAL]  An attempt is made to ignore or supply a handler for SIGKILL or
  120.                SIGSTOP.
  121.  
  122. SSEEEE AALLSSOO
  123.      kill(1),  ptrace(2),  kill(2),  sigaction(2),  sigprocmask(2),
  124.      sigsuspend(2),  sigstack(2),  setjmp(3),  tty(4)
  125.  
  126. HHIISSTTOORRYY
  127.      This ssiiggnnaall facility appeared in 4.0BSD.
  128.  
  129. 4th Berkeley Distribution        July 31, 1991                               2
  130.  
  131.  
  132.  
  133.