Module Name: src Committed By: dholland Date: Sat Jul 9 23:12:27 UTC 2016
Modified Files: src/share/man/man7: signal.7 Log Message: Document all the signals properly. Please review. Kick out the list of async-signal-safe functions (it is now in sigaction(2)) because this is not a programmer-facing document. XXX: if anyone knows definitively whether SIGEMT is actually used by XXX: anything, please update the weasel words I put in. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/share/man/man7/signal.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man7/signal.7 diff -u src/share/man/man7/signal.7:1.17 src/share/man/man7/signal.7:1.18 --- src/share/man/man7/signal.7:1.17 Sat Jul 19 14:53:22 2014 +++ src/share/man/man7/signal.7 Sat Jul 9 23:12:27 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: signal.7,v 1.17 2014/07/19 14:53:22 roy Exp $ +.\" $NetBSD: signal.7,v 1.18 2016/07/09 23:12:27 dholland Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -24,213 +24,569 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 18, 2014 +.Dd July 9, 2016 .Dt SIGNAL 7 .Os .Sh NAME .Nm signal .Nd signal facilities .Sh DESCRIPTION -The -.In signal.h -header file defines the following signals: +A +.Nm +is a system-level notification delivered to a process. +Signals may be generated as the result of process activity, by certain +user inputs, by kernel facilities or subsystems, or sent +programmatically by other processes or by users. +There is a small fixed set of signals, each with a symbolic name and a +number. +For historical reasons many of the numbers are ``well-known values'', +which are in practice the same on all implementations and +realistically can never be changed. +(Nonetheless, compiled code should always use only the symbolic +names.) +Many/most signals also have specific semantics, both in how they can +be generated and in their effects. +Some are special cases in ways that have quite far-reaching +consequences. +.Pp +When a signal is +.Em posted +.Pq Dq sent +to a process, in general any of several things can happen. +If the process has elected to +.Em ignore +the signal, it is discarded and nothing happens. +(Some signals may not be ignored, however.) +If the process has elected to +.Em block +the signal temporarily, delivery is postponed until the process +later unblocks that signal. +Otherwise, the signal is +.Em delivered, +meaning that whatever the process is doing is interrupted in order to +react to the signal. +(Note that processes that are waiting in the kernel must unwind what +they are doing for signals to be delivered. +This can sometimes be expensive. +See +.Xr sigaction 2 +for further information.) +.Pp +If the process has elected to +.Em catch +the signal, which means that the process has installed a handler to +react to the signal in some process-specific way, the kernel arranges +for the process's handler logic to be invoked. +This is always done in a way that allows the process to resume if +desired. +(Note, however, that some signals may not be caught.) +Otherwise, the default action for the signal is taken. +For most signals the default action is a core dump. +See the table below. +Note that the term +.Em delivery +is also used for the specific process of arranging for a signal +handler to be invoked. +.Pp +In general, signals are delivered as soon as they are posted. +(Some delays may occur due to scheduling.) +However, in some cases a process that has been sleeping in the kernel +may need to do slow things as part of unwinding its state; this can +sometimes lead to human-perceptible delays. +.Pp +Also, some sleep states within the kernel are +.Em uninterruptible +meaning that signals posted will have no effect until the state +clears. +These states are supposed to be short-term only, but sometimes kernel +bugs make this not the case and one can end up with unkillable +processes. +Such processes appear in state "D" in +.Xr ps 1 . +In general the only way to get rid of them is to reboot. +(However, when the "wchan" reported is "tstile", it means the process +is waiting for some other process to release resources; sometimes if +one can find and kill that process the situation is recoverable.) +.Ss Signal list +The following signals are defined in +.Nx : .Pp -.Bl -column ".Sy Value" ".Dv SIGVTALARM" "terminate process" -compact -.It Sy "Value" Ta Sy "Name" Ta Sy "Default Action" Ta Sy "Description" -.It 1 Ta Dv SIGHUP Ta "terminate process" Ta "terminal line hangup" -.It 2 Ta Dv SIGINT Ta "terminate process" Ta "interrupt program" -.It 3 Ta Dv SIGQUIT Ta "create core image" Ta "quit program" -.It 4 Ta Dv SIGILL Ta "create core image" Ta "illegal instruction" -.It 5 Ta Dv SIGTRAP Ta "create core image" Ta "trace trap" -.It 6 Ta Dv SIGABRT Ta "create core image" Ta Xr abort 3 -call (formerly -.Dv SIGIOT ) -.It 7 Ta Dv SIGEMT Ta "create core image" Ta "emulate instruction executed" -.It 8 Ta Dv SIGFPE Ta "create core image" Ta "floating-point exception" -.It 9 Ta Dv SIGKILL Ta "terminate process" Ta "kill program (cannot be caught or ignored)" -.It 10 Ta Dv SIGBUS Ta "create core image" Ta "bus error" -.It 11 Ta Dv SIGSEGV Ta "create core image" Ta "segmentation violation" -.It 12 Ta Dv SIGSYS Ta "create core image" Ta "invalid system call argument" -.It 13 Ta Dv SIGPIPE Ta "terminate process" Ta "write to a pipe with no reader" -.It 14 Ta Dv SIGALRM Ta "terminate process" Ta "real-time timer expired" -.It 15 Ta Dv SIGTERM Ta "terminate process" Ta "software termination signal" -.It 16 Ta Dv SIGURG Ta "discard signal" Ta "urgent condition present on socket" -.It 17 Ta Dv SIGSTOP Ta "stop process" Ta "stop (cannot be caught or ignored)" -.It 18 Ta Dv SIGTSTP Ta "stop process" Ta "stop signal generated from keyboard" -.It 19 Ta Dv SIGCONT Ta "discard signal" Ta "continue after stop (even if blocked or ignored)" -.It 20 Ta Dv SIGCHLD Ta "discard signal" Ta "child status has changed" -.It 21 Ta Dv SIGTTIN Ta "stop process" Ta "background read attempted from control terminal" -.It 22 Ta Dv SIGTTOU Ta "stop process" Ta "background write attempted to control terminal" -.It 23 Ta Dv SIGIO Ta "discard signal" Ta "I/O is possible on a descriptor (see" -.Xr fcntl 2 ) -.It 24 Ta Dv SIGXCPU Ta "terminate process" Ta "CPU time limit exceeded (see" -.Xr setrlimit 2 ) -.It 25 Ta Dv SIGXFSZ Ta "terminate process" Ta "file size limit exceeded (see" -.Xr setrlimit 2 ) -.It 26 Ta Dv SIGVTALRM Ta "terminate process" Ta "virtual time alarm (see" -.Xr setitimer 2 ) -.It 27 Ta Dv SIGPROF Ta "terminate process" Ta "profiling timer alarm (see" -.Xr setitimer 2 ) -.It 28 Ta Dv SIGWINCH Ta "discard signal" Ta "window size change" -.It 29 Ta Dv SIGINFO Ta "discard signal" Ta "status request from keyboard" -.It 30 Ta Dv SIGUSR1 Ta "terminate process" Ta "user-defined signal 1" -.It 31 Ta Dv SIGUSR2 Ta "terminate process" Ta "user-defined signal 2" -.It 32 Ta Dv SIGPWR Ta "discard signal" Ta "power failure/restart" +.Bl -column ".Sy SIGVTALRM" "Profiling timer expired blablabla" -compact +.\".It Sy "Symbol" Ta Sy "Descriptive name" +.It Dv SIGHUP Ta "Hangup" +.It Dv SIGINT Ta "Interrupt" +.It Dv SIGQUIT Ta "Quit" +.It Dv SIGILL Ta "Illegal instruction" +.It Dv SIGTRAP Ta "Trace/BPT trap" +.It Dv SIGABRT Ta "Abort trap" +.It Dv SIGEMT Ta "EMT trap" +.It Dv SIGFPE Ta "Floating point exception" +.It Dv SIGKILL Ta "Killed" +.It Dv SIGBUS Ta "Bus error" +.It Dv SIGSEGV Ta "Segmentation fault" +.It Dv SIGSYS Ta "Bad system call" +.It Dv SIGPIPE Ta "Broken pipe" +.It Dv SIGALRM Ta "Alarm clock" +.It Dv SIGTERM Ta "Terminated" +.It Dv SIGURG Ta "Urgent I/O condition" +.It Dv SIGSTOP Ta "Suspended (signal)" +.It Dv SIGTSTP Ta "Suspended" +.It Dv SIGCONT Ta "Continued" +.It Dv SIGCHLD Ta "Child exited" +.It Dv SIGTTIN Ta "Stopped (tty input)" +.It Dv SIGTTOU Ta "Stopped (tty output)" +.It Dv SIGIO Ta "I/O possible" +.It Dv SIGXCPU Ta "CPU time limit exceeded" +.It Dv SIGXFSZ Ta "File size limit exceeded" +.It Dv SIGVTALRM Ta "Virtual timer expired" +.It Dv SIGPROF Ta "Profiling timer expired" +.It Dv SIGWINCH Ta "Window size changed" +.It Dv SIGINFO Ta "Information request" +.It Dv SIGUSR1 Ta "User defined signal 1" +.It Dv SIGUSR2 Ta "User defined signal 2" +.It Dv SIGPWR Ta "Power fail/restart" .El .Pp -A function that is async-signal-safe is either reentrant or -non-interruptible by signals. -This means that they can be used in -signal handlers -and in the child of threaded programs after doing -.Xr fork 2 . +These are numbered 1 to 32. +(There is no signal 0; 0 is a reserved value that can be used as a +no-op with some signal operations.) .Pp -The following functions are async-signal-safe. -Any function not listed -below is unsafe to use in signal handlers. +Detailed descriptions of these signals follow. .Pp -.Xr _Exit 2 , -.Xr _exit 2 , -.Xr abort 3 , -.Xr accept 2 , -.Xr access 2 , -.\" .Xr aio_error -.\" .Xr aio_return -.\" .Xr aio_suspend +.Bl -tag -width "aaa" +.\" ************ +.It Dv SIGHUP (Hangup) +This signal is generated by the tty driver +.Xr tty 4 +to indicate a hangup condition on a process's controlling terminal: +the user has disconnected. +Accordingly, the default action is to terminate the process. +This signal is also used by many daemons, +such as +.Xr inetd 8 , +as a cue to reload configuration. +The number for +.Dv SIGHUP +is 1, which is quite well known. +.\" ************ +.It Dv SIGINT (Interrupt) +This signal is generated by the tty driver +.Xr tty 4 +when the user presses the interrupt character, normally control-C. +The default action is to terminate the process. +The number for +.Dv SIGINT +is 2. +.\" ************ +.It Dv SIGQUIT Ta (Quit) +This signal is generated by the tty driver +.Xr tty 4 +when the user presses the quit character, normally control-backspace. +The default action is to terminate the process and dump core. +The number for +.Dv SIGQUIT +is 3. +.\" ************ +.It Dv SIGILL Ta (Illegal instruction) +This signal is generated synchronously by the kernel when the process +executes an invalid instruction. +The default action is to terminate the process and dump core. +Note: the results of executing an illegal instruction when +.Dv SIGILL +is blocked or ignored are formally unspecified. +The number for +.Dv SIGILL +is 4. +.\" ************ +.It Dv SIGTRAP Ta (Trace/BPT trap) +This signal is used when a process is being traced +(see +.Xr ptrace 2 ) +to indicate that the process has stopped at a breakpoint or after +single-stepping. +It is normally intercepted by the debugger and not exposed to the +debuggee. +The default action is to terminate the process and dump core. +The number for +.Dv SIGTRAP +is 5. +.\" ************ +.It Dv SIGABRT Ta (Abort trap) +This signal is generated when the +.Xr abort 3 +standard library function is called. +The default action is to terminate the process and dump core. +The number for +.Dv SIGABRT +is 6. +This number was also formerly used for +.Dv SIGIOT , +which is no longer defined. +.\" ************ +.It Dv SIGEMT Ta (EMT trap) +In theory this signal is generated when an instruction needs to be +emulated. +.\" XXX expand this -- I don't know, grep isn't helping much and +.\" information seems pretty thin on the ground on the net. +The default action is to terminate the process and dump core. +The number for +.Dv SIGEMT +is 7. +.\" ************ +.It Dv SIGFPE Ta (Floating point exception) +This signal is generated when an invalid floating point operation is +detected by hardware or by a soft-float library. +The default action is to terminate the process and dump core. +The number for +.Dv SIGFPE +is 8. +.\" ************ +.It Dv SIGKILL Ta (Killed) +This signal cannot be caught or ignored. +The (unconditional) action is to terminate the process. +It is most often sent by system administrators, but is also generated +by the kernel in response to running completely out of memory and +swap space. +Note that because many processes need to perform cleanup before +exiting, it is usually best (as a user or administrator) to not deploy +.Dv SIGKILL +until a process has failed to respond to other signals. +The number for +.Dv SIGKILL +is 9, which is extremely well known. +.\" ************ +.It Dv SIGBUS Ta (Bus error) +This signal is generated synchronously by the kernel when the process +performs certain kinds of invalid memory accesses. +The most common cause of +.Dv SIGBUS +is an unaligned memory access; however, on some architectures it may +cover other memory conditions, such as attempts to access memory +belonging to the kernel. +The default action is to terminate the process and dump core. +Note: the results of performing such invalid accesses when +.Dv SIGBUS +is blocked or ignored are formally unspecified. +The number for +.Dv SIGBUS +is 10. +.\" ************ +.It Dv SIGSEGV Ta (Segmentation fault) +This signal is generated synchronously by the kernel when the process +attempts to access unmapped memory, or access memory in a manner that +the protection settings for that memory region do not permit. +On some architectures other assorted permission or protection errors +also yield +.Dv SIGSEGV . +On +.Nx , +passing invalid pointers to system calls will yield failure with +.Er EFAULT +but not also +.Dv SIGSEGV . +The default action is to terminate the process and dump core. +Note: the results of an invalid memory access when +.Dv SIGSEGV +is blocked or ignored are formally unspecified. +The number for +.Dv SIGSEGV +is 11, which is very well known. +.\" ************ +.It Dv SIGSYS Ta (Bad system call) +This signal is generated by the kernel, in addition to failing with +.Er ENOSYS , +when a system call is made using an invalid system call number. +.\" (This facility was intended to facilitate emulation of system calls.) +The default action is to terminate the process and dump core. +The number for +.Dv SIGSYS +is 12. +.\" ************ +.It Dv SIGPIPE Ta (Broken pipe) +This signal is generated by the kernel, in addition to failing with +.Er EPIPE , +when a +.Xr write 2 +call or similar is made on a pipe or socket that has been closed and +has no readers. +The default action is to terminate the process. +The number for +.Dv SIGPIPE +is 13. +.\" ************ +.It Dv SIGALRM Ta (Alarm clock) +This signal is generated by the kernel when a real-time timer expires. +See .Xr alarm 3 , -.Xr bind 2 , -.Xr cfgetispeed 3 , -.Xr cfgetospeed 3 , -.Xr cfsetispeed 3 , -.Xr cfsetospeed 3 , -.Xr chdir 2 , -.Xr chmod 2 , -.Xr chown 2 , -.Xr clock_gettime 2 , -.Xr close 2 , -.Xr connect 2 , -.Xr creat 3 , -.Xr dup 2 , -.Xr dup2 2 , -.Xr execle 3 , -.Xr execve 2 , -.Xr fchmod 2 , -.Xr fchown 2 , -.Xr fcntl 2 , -.Xr fdatasync 2 , -.Xr fork 2 , -.Xr fpathconf 2 , -.Xr fstat 2 , -.Xr fsync 2 , -.Xr ftruncate 2 , -.Xr getegid 2 , -.Xr geteuid 2 , -.Xr getgid 2 , -.Xr getgroups 2 , -.Xr getpeername 2 , -.Xr getpgrp 2 , -.Xr getpid 2 , -.Xr getppid 2 , -.Xr getsockname 2 , -.Xr getsockopt 2 , -.Xr getuid 2 , -.Xr kill 2 , -.Xr link 2 , -.Xr listen 2 , -.Xr lseek 2 , -.Xr lstat 2 , -.Xr mkdir 2 , -.Xr mkfifo 2 , -.Xr open 2 , -.Xr pathconf 2 , -.Xr pause 3 , -.Xr pipe 2 , -.Xr poll 2 , -.\" .Xr posix_trace_event 2 -.\" .Xr pselect 2 -.Xr pthread_mutex_unlock 3 , -.Xr raise 3 , -.Xr read 2 , -.Xr readlink 2 , -.Xr recv 2 , -.Xr recvfrom 2 , -.Xr recvmsg 2 , -.Xr rename 2 , -.Xr rmdir 2 , -.Xr select 2 , -.Xr sem_post 3 , -.Xr send 2 , -.Xr sendmsg 2 , -.Xr sendto 2 , -.Xr setgid 2 , -.Xr setpgid 2 , -.Xr setsid 2 , -.Xr setsockopt 2 , -.Xr setuid 2 , -.Xr shutdown 2 , -.Xr sigaction 2 , -.Xr sigaddset 3 , -.Xr sigdelset 3 , -.Xr sigemptyset 3 , -.Xr sigfillset 3 , -.Xr sigismember 3 , -.Xr sleep 3 , -.Xr signal 3 , -.Xr sigpause 3 , -.Xr sigpending 2 , -.Xr sigprocmask 2 , -.\" .Xr sigqueue -.Xr sigset 3 , -.Xr sigsuspend 2 , -.Xr sockatmark 3 , -.Xr socket 2 , -.Xr socketpair 2 , -.Xr stat 2 , -.Xr symlink 2 , -.Xr sysconf 3 , -.Xr tcdrain 3 , -.Xr tcflow 3 , -.Xr tcflush 3 , -.Xr tcgetattr 3 , -.Xr tcgetpgrp 3 , -.Xr tcsendbreak 3 , -.Xr tcsetattr 3 , -.Xr tcsetpgrp 3 , -.Xr time 3 , -.Xr timer_getoverrun 2 , -.Xr timer_gettime 2 , -.Xr timer_settime 2 , -.Xr times 3 , -.Xr umask 2 , -.Xr uname 3 , -.Xr unlink 2 , -.Xr utime 3 , -.Xr wait 2 , -.Xr waitpid 2 , -.Xr write 2 . -.Sh SEE ALSO -.Xr kill 1 , -.Xr kill 2 , -.Xr ptrace 2 , -.Xr sigaction 2 , -.Xr sigaltstack 2 , -.Xr sigprocmask 2 , -.Xr sigstack 2 , -.Xr sigsuspend 2 , -.Xr fpgetmask 3 , -.Xr fpsetmask 3 , -.Xr setjmp 3 , -.Xr sigblock 3 , -.Xr siginterrupt 3 , -.Xr signal 3 , -.Xr sigpause 3 , -.Xr sigsetmask 3 , -.Xr sigsetops 3 , +.Xr setitimer 2 , +and +.Xr timer_settime 2 . +The default action is to terminate the process. +The number for +.Dv SIGALRM +is 14. +.\" ************ +.It Dv SIGTERM Ta (Terminated) +This signal is the default signal sent by +.Xr kill 1 +and represents a user or administrator request that a program shut +down. +It is sent to all processes as part of the +.Xr shutdown 8 +procedure. +The default action is to terminate the process. +The number for +.Dv SIGTERM +is 15. +.\" ************ +.It Dv SIGURG Ta (Urgent I/O condition) +This signal is generated when an ``urgent condition'' exists on a +socket. +In practice this means when +.Xr tcp 4 +out-of-band data has arrived. +The default action is to do nothing. +The number for +.Dv SIGURG +is 16. +.\" ************ +.It Dv SIGSTOP Ta (Suspended (signal)) +This signal cannot be caught or ignored. +The (unconditional) action is to stop the process. +Note that like with +.Dv SIGKILL +(and for similar reasons) it is best to not send this signal until a +process has failed to respond to +.Dv SIGTSTP . +It can also be used by processes to stop themselves after catching +.Dv SIGTSTP . +A process that is explicitly stopped will not run again until told to +with +.Dv SIGCONT . +The number for +.Dv SIGSTOP +is 17. +.\" ************ +.It Dv SIGTSTP Ta (Suspended) +This signal is generated by the tty driver +.Xr tty 4 +when the user presses the stop character, normally control-Z. +The default action is to stop the process. +The number for +.Dv SIGTSTP +is 18. +.\" ************ +.It Dv SIGCONT Ta (Continued) +This signal is generated by the job-control feature of shells to +manage processes. +It causes the target process to start executing again after previously +being stopped. +This happens as a magic extra effect +.Nm before +the signal is actually delivered. +The default action when the signal is delivered is to do nothing (else). +The number for +.Dv SIGCONT +is 19. +.\" ************ +.It Dv SIGCHLD Ta (Child exited) +This signal is generated by the kernel when one of a process's +immediate children exits and can be waited for using one of the +.Xr wait 3 +family of functions. +The default action is to do nothing. +As a special case hack, if +.Dv SIGCHLD +is ignored (not merely blocked) when a process is +.Em created , +it is detached from its parent immediately so it need not be waited +for. +This behavior is a System V historic wart, implemented in +.Nx +only for compatibility. +It is not portable, not recommended, and should not be used by new +code. +.\" XXX should refer to something that can be used by new code... +The number for +.Dv SIGCHLD +is 20. +This signal was spelled +.Dv SIGCLD +in old System V versions and today many systems provide both +spellings. +.\" ************ +.It Dv SIGTTIN Ta (Stopped (tty input)) +This signal is generated by the tty driver .Xr tty 4 +when a process that is not in the foreground of its controlling +terminal attempts to read from this terminal. +The default action is to stop the process. +The number for +.Dv SIGTTIN +is 21. +.\" ************ +.It Dv SIGTTOU Ta (Stopped (tty output)) +This signal is generated by the tty driver +.Xr tty 4 +when a process that is not in the foreground of its controlling +terminal attempts to write to this terminal, if the terminal is +configured accordingly, which is not the default. +(See +.Xr termios 4 .) +The default action is to stop the process. +The number for +.Dv SIGTTOU +is 22. +.\" ************ +.It Dv SIGIO Ta (I/O possible) +This signal is sent by the kernel when I/O becomes possible on a file +handle opened for asynchronous access with +.Dv O_ASYNC . +See +.Xr open 2 +and +.Xr fcntl 2 . +The default action is to do nothing. +The number for +.Dv SIGIO +is 23. +.\" ************ +.It Dv SIGXCPU Ta (CPU time limit exceeded) +This signal is sent by the kernel when the amount of CPU time consumed +exceeds the configured limit. +See +.Xr setrlimit 2 +and the +ulimit +and +rlimit +builtins of +.Xr sh 1 +and +.Xr csh 1 +respectively. +The default action is to terminate the process. +The number for +.Dv SIGXCPU +is 24. +.\" ************ +.It Dv SIGXFSZ Ta (File size limit exceeded) +This signal is sent by the kernel when a write causes the size of a +file to exceed the configured limit. +See +.Xr setrlimit 2 +and the +ulimit +and +rlimit +builtins of +.Xr sh 1 +and +.Xr csh 1 +respectively. +The default action is to terminate the process. +The number for +.Dv SIGXFSZ +is 25. +.\" ************ +.It Dv SIGVTALRM Ta (Virtual timer expired) +This signal is generated by the kernel when a virtual-time (process +execution time) timer expires. +See +.Xr setitimer 2 +and +.Xr timer_settime 2 . +The default action is to terminate the process. +The number for +.Dv SIGVTALRM +is 26. +.\" ************ +.It Dv SIGPROF Ta (Profiling timer expired) +This signal is generated by the kernel when a profiling timer +expires. +See +.Xr setitimer 2 +and +.Xr timer_settime 2 . +The default action is to terminate the process. +The number for +.Dv SIGPROF +is 27. +.\" ************ +.It Dv SIGWINCH Ta (Window size changed) +This signal is generated by the tty driver +.Xr tty 4 +when the stored window size of the process's controlling terminal has +changed. +The default action is to do nothing. +The number for +.Dv SIGWINCH +is 28. +.\" ************ +.It Dv SIGINFO Ta (Information request) +This signal is generated by the tty driver +.Xr tty 4 +when the user presses the status request character, normally +control-T. +The default action is to do nothing. +The number for +.Dv SIGINFO +is 29. +.\" ************ +.It Dv SIGUSR1 Ta (User defined signal 1) +This signal is not generated by the system and is made available for +applications to use for their own purposes. +Many daemons use it for restart or reload requests of various types. +The default action is to terminate the process. +The number for +.Dv SIGUSR1 +is 30. +.\" ************ +.It Dv SIGUSR2 Ta (User defined signal 2) +This signal is not generated by the system and is made available for +applications to use for their own purposes. +The default action is to terminate the process. +The number for +.Dv SIGUSR2 +is 31. +.\" ************ +.It Dv SIGPWR Ta (Power fail/restart) +This signal is notionally sent by the kernel or by a privileged +monitor process when an external power failure is detected, and again +when power has been restored. +Currently +.Nx +does not in fact send +.Dv SIGPWR , +although it is possible to prepare a custom configuration for +.Xr powerd 8 +that does so. +The default action is to do nothing. +The number for +.Dv SIGPWR +is 32. +.\" ************ +.Ss Shell Interface +Signals may be sent with the +.Xr kill 1 +utility, either by number or the symbolic name without the ``SIG'' part. +This utility is built into many shells to allow addressing job control +jobs. +.Ss Program Interface +In C code signals may be sent using +.Xr raise 3, +.Xr kill 2, +.Xr pthread_kill 2, +and some other related functions. +.Pp +Signals may be caught or ignored using +.Xr sigaction 2 +or the simpler +.Xr signal 3 , +and blocked using +.Xr sigprocmask . .Sh STANDARDS -These signals conform to -.St -p1003.1-90 , -with the exception of +The .Dv SIGTRAP , .Dv SIGEMT , .Dv SIGBUS , @@ -244,18 +600,16 @@ with the exception of .Dv SIGWINCH , and .Dv SIGINFO -which are Berkeley extensions (available on most +signals are long-existing Berkeley extensions, available on most .Bx Ns \-derived -systems), and +systems. +The .Dv SIGPWR -which comes from System V. +signal comes from System V. +.Pp +The remaining signals conform to +.St -p1003.1-90 . .Sh HISTORY .Dv SIGPWR was introduced in .Nx 1.4 . -.Sh NOTES -The current -.Nx -kernel never generates the -.Dv SIGPWR -signal.