summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-17 19:20:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-17 19:20:07 +0000
commitfa860e14ab4d20456b9fd9b1a16a873fed8dc8d3 (patch)
tree63f01156abb3c81acfa6199f73d6ffe3ccb68622 /lib/libc/sys
parentff92ad1b33e9cc854750bd5309abc4677aa84061 (diff)
first cut at "what is allowed in a signal handler, based on but extended from FreeBSD list
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/sigaction.2129
1 files changed, 125 insertions, 4 deletions
diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2
index fe54cb11de3..63db0eac438 100644
--- a/lib/libc/sys/sigaction.2
+++ b/lib/libc/sys/sigaction.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sigaction.2,v 1.25 2000/12/15 14:31:19 aaron Exp $
+.\" $OpenBSD: sigaction.2,v 1.26 2001/01/17 19:20:06 deraadt Exp $
.\" $NetBSD: sigaction.2,v 1.7 1995/10/12 15:41:16 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -438,9 +438,10 @@ signal-catching functions:
.Ed
.Pp
All functions not in the above list are considered to be unsafe
-with respect to signals.
-That is to say, the behaviour of such functions when called from a
-signal handler is undefined.
+with respect to signals. That is to say, the behaviour of such
+functions when called from a signal handler is undefined.
+In general though, signal handlers should do little more than set a
+flag; most other actions are not safe.
.Pp
As well, it is advised that signal handlers guard against
modification of the external symbol
@@ -568,6 +569,126 @@ The
and
.Dv SA_SIGINFO
flags are options commonly found in other operating systems.
+The following functions are either reentrant or not interruptible
+by signals and are async-signal safe.
+Therefore applications may
+invoke them, without restriction, from signal-catching functions:
+.Pp
+Base Interfaces:
+.Pp
+.Fn _exit ,
+.Fn access ,
+.Fn alarm ,
+.Fn cfgetispeed ,
+.Fn cfgetospeed ,
+.Fn cfsetispeed ,
+.Fn cfsetospeed ,
+.Fn chdir ,
+.Fn chmod ,
+.Fn chown ,
+.Fn close ,
+.Fn creat ,
+.Fn dup ,
+.Fn dup2 ,
+.Fn execle ,
+.Fn execve ,
+.Fn fcntl ,
+.Fn fork ,
+.Fn fpathconf ,
+.Fn fstat ,
+.Fn fsync ,
+.Fn getegid ,
+.Fn geteuid ,
+.Fn getgid ,
+.Fn getgroups ,
+.Fn getpgrp ,
+.Fn getpid ,
+.Fn getppid ,
+.Fn getuid ,
+.Fn kill ,
+.Fn link ,
+.Fn lseek ,
+.Fn mkdir ,
+.Fn mkfifo ,
+.Fn open ,
+.Fn pathconf ,
+.Fn pause ,
+.Fn pipe ,
+.Fn raise ,
+.Fn read ,
+.Fn rename ,
+.Fn rmdir ,
+.Fn setgid ,
+.Fn setpgid ,
+.Fn setsid ,
+.Fn setuid ,
+.Fn sigaction ,
+.Fn sigaddset ,
+.Fn sigdelset ,
+.Fn sigemptyset ,
+.Fn sigfillset ,
+.Fn sigismember ,
+.Fn signal ,
+.Fn sigpending ,
+.Fn sigprocmask ,
+.Fn sigsuspend ,
+.Fn sleep ,
+.Fn stat ,
+.Fn sysconf ,
+.Fn tcdrain ,
+.Fn tcflow ,
+.Fn tcflush ,
+.Fn tcgetattr ,
+.Fn tcgetpgrp ,
+.Fn tcsendbreak ,
+.Fn tcsetattr ,
+.Fn tcsetpgrp ,
+.Fn time ,
+.Fn times ,
+.Fn umask ,
+.Fn uname ,
+.Fn unlink ,
+.Fn utime ,
+.Fn wait ,
+.Fn waitpid ,
+.Fn write .
+.Pp
+Realtime Interfaces:
+.Pp
+.Fn aio_error ,
+.Fn clock_gettime ,
+.Fn sigpause ,
+.Fn timer_getoverrun ,
+.Fn aio_return ,
+.Fn fdatasync ,
+.Fn sigqueue ,
+.Fn timer_gettime ,
+.Fn aio_suspend ,
+.Fn sem_post ,
+.Fn sigset ,
+.Fn timer_settime .
+.Pp
+ANSI C Interfaces:
+.Pp
+.Fn strcpy ,
+.Fn strcat ,
+.Fn strncpy ,
+.Fn strncat ,
+and perhaps some others.
+.Pp
+Extension Interfaces:
+.Pp
+.Fn strlcpy ,
+.Fn strlcat .
+.Pp
+All functions not in the above lists are considered to be unsafe
+with respect to signals. That is to say, the behaviour of such
+functions when called from a signal handler is undefined.
+.Pp
+As well, inside the signal handler it is also considered more safe to
+make a copy the global variable
+.Va errno
+and restore it before returning from the signal handler.
.Sh SEE ALSO
.Xr kill 1 ,
.Xr kill 2 ,