1signal(3UCB)       SunOS/BSD Compatibility Library Functions      signal(3UCB)
2
3
4

NAME

6       signal - simplified software signal facilities
7

SYNOPSIS

9       /usr/ucb/cc [ flag ... ] file ...
10       #include <signal.h>
11
12       void (*signal(sig, func))()
13       int sig;
14       void (*func)();
15
16

DESCRIPTION

18       signal()  is  a  simplified  interface to the more general sigvec(3UCB)
19       facility.  Programs that use signal() in  preference  to  sigvec()  are
20       more likely to be portable to all systems.
21
22
23       A  signal is generated by some abnormal event, initiated by a user at a
24       terminal (quit, interrupt, stop), by a program error (bus error, etc.),
25       by  request  of  another  program  (kill), or when a process is stopped
26       because it wishes to access its control terminal  while  in  the  back‐
27       ground  (see  termio(7I)).  Signals  are  optionally  generated  when a
28       process resumes after being stopped, when the status of child processes
29       changes,  or  when input is ready at the control terminal. Most signals
30       cause termination of the receiving process if no action is taken;  some
31       signals  instead cause the process receiving them to be stopped, or are
32       simply discarded if the process has not requested otherwise. Except for
33       the  SIGKILL  and  SIGSTOP  signals,  the  signal() call allows signals
34       either to be ignored or to  interrupt  to  a  specified  location.  See
35       sigvec(3UCB) for a complete list of the signals.
36
37
38       If  func  is  SIG_DFL, the default action for signal sig is reinstated;
39       this default is termination (with a core  image  for  starred  signals)
40       except for signals marked with · or a dagger. Signals marked with · are
41       discarded if the action is SIG_DFL; signals marked with a dagger  cause
42       the  process  to  stop.   If func is SIG_IGN the signal is subsequently
43       ignored and pending instances of the signal are  discarded.  Otherwise,
44       when  the signal occurs further occurrences of the signal are automati‐
45       cally blocked and func is called.
46
47
48       A return from the function unblocks the handled  signal  and  continues
49       the process at the point it was interrupted.
50
51
52       If  a  caught  signal occurs during certain functions,  terminating the
53       call prematurely, the call is automatically  restarted.  In  particular
54       this can occur during a read(2) or write(2) on a slow device (such as a
55       terminal; but not a file) and during a wait(3C).
56
57
58       The value of signal() is the previous (or initial) value  of  func  for
59       the particular signal.
60
61
62       After a fork(2) or vfork(2) the child inherits all signals.  An exec(2)
63       resets all caught signals to the default action; ignored signals remain
64       ignored.
65

RETURN VALUES

67       The  previous  action is returned on a successful call. Otherwise,−1 is
68       returned and errno is set to indicate the error.
69

ERRORS

71       signal() will fail and no action  will  take  place  if  the  following
72       occurs:
73
74       EINVAL    sig is not a valid signal number, or is SIGKILL or SIGSTOP.
75
76

SEE ALSO

78       kill(1),   exec(2),   fcntl(2),  fork(2),  getitimer(2),  getrlimit(2),
79       kill(2),  read(2),  sigaction(2),  write(2),   abort(3C),   ptrace(3C),
80       setjmp(3C),  setjmp(3UCB), sigblock(3UCB), signal(3C), signal.h(3HEAD),
81       sigstack(3UCB), sigvec(3UCB), wait(3C), wait(3UCB), termio(7I)
82

NOTES

84       Use of these interfaces should be restricted to only applications writ‐
85       ten  on  BSD platforms.  Use of these interfaces with any of the system
86       libraries or in multi-threaded applications is unsupported.
87
88
89       The handler routine func can be declared:
90
91         void handler(signum) int signum;
92
93
94
95       Here signum is the signal number. See sigvec(3UCB)  for  more  informa‐
96       tion.
97
98
99
100SunOS 5.11                        30 Oct 2007                     signal(3UCB)
Impressum