summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-08-05 01:09:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-08-05 01:09:52 +0000
commite7d8fdfd21eae05bfe5f4ed74ca39f2454e50d21 (patch)
treee6b51a209bdd9f345b71ba3f10397fd0038f0b41 /lib
parentf3aaa76ed2539cb9fbb8a43971355d780d3ac102 (diff)
talk about errno; and try to list sighandler safe functions
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/sigaction.2118
1 files changed, 117 insertions, 1 deletions
diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2
index a1a5d70b623..9dedc30e33e 100644
--- a/lib/libc/sys/sigaction.2
+++ b/lib/libc/sys/sigaction.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sigaction.2,v 1.21 2000/01/22 12:00:43 aaron Exp $
+.\" $OpenBSD: sigaction.2,v 1.22 2000/08/05 01:09:51 deraadt Exp $
.\" $NetBSD: sigaction.2,v 1.7 1995/10/12 15:41:16 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -337,6 +337,122 @@ is not allowed to block
or
.Dv SIGSTOP .
Any attempt to do so will be silently ignored.
+.Pp
+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
+.Bd -ragged -offset indent
+.Xr _exit 2 ,
+.Xr access 2 ,
+.Xr alarm 3 ,
+.Xr cfgetispeed 3 ,
+.Xr cfgetospeed 3 ,
+.Xr cfsetispeed 3 ,
+.Xr cfsetospeed 3 ,
+.Xr chdir 2 ,
+.Xr chmod 2 ,
+.Xr chown 2 ,
+.Xr close 2 ,
+.Xr creat 2 ,
+.Xr dup 2 ,
+.Xr dup2 2 ,
+.Xr execle 2 ,
+.Xr execve 2 ,
+.Xr fcntl 2 ,
+.Xr fork 2 ,
+.Xr fpathconf 2 ,
+.Xr fstat 2 ,
+.Xr fsync 2 ,
+.Xr getegid 2 ,
+.Xr geteuid 2 ,
+.Xr getgid 2 ,
+.Xr getgroups 2 ,
+.Xr getpgrp 2 ,
+.Xr getpid 2 ,
+.Xr getppid 2 ,
+.Xr getuid 2 ,
+.Xr kill 2 ,
+.Xr link 2 ,
+.Xr lseek 2 ,
+.Xr mkdir 2 ,
+.Xr mkfifo 2 ,
+.Xr open 2 ,
+.Xr pathconf 2 ,
+.Xr pause 2 ,
+.Xr pipe 2 ,
+.Xr raise 3 ,
+.Xr read 2 ,
+.Xr rename 2 ,
+.Xr rmdir 2 ,
+.Xr setgid 2 ,
+.Xr setpgid 2 ,
+.Xr setsid 2 ,
+.Xr setuid 2 ,
+.Xr sigaction 2 ,
+.Xr sigaddset 3 ,
+.Xr sigdelset 3 ,
+.Xr sigemptyset 3 ,
+.Xr sigfillset 3 ,
+.Xr sigismember 3 ,
+.Xr signal 3 ,
+.Xr sigpending 2 ,
+.Xr sigprocmask 2 ,
+.Xr sigsuspend 2 ,
+.Xr sleep 3 ,
+.Xr stat 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 times 3 ,
+.Xr umask 2 ,
+.Xr uname 3 ,
+.Xr unlink 2 ,
+.Xr utime 3 ,
+.Xr wait 2 ,
+.Xr waitpid 2 ,
+.Xr write 2 .
+.Xr sigpause 3 ,
+.Xr sigset 3 .
+.\" .Fn aio_error ,
+.\" .Fn clock_gettime ,
+.\" .Fn timer_getoverrun ,
+.\" .Fn aio_return ,
+.\" .Fn fdatasync ,
+.\" .Fn sigqueue ,
+.\" .Fn timer_gettime ,
+.\" .Fn aio_suspend ,
+.\" .Fn sem_post ,
+.\" .Fn timer_settime .
+.Ed
+.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, it is advised that signal handlers be careful to gaurd against
+modification of the external symbol
+.Va errno ,
+by the above functions, and consider saving it at entry and restoring
+it on return, thus:
+.Bd -literal -offset indent
+void
+handler(sig)
+{
+ int save_errno = errno;
+
+ ...
+ errno = save_errno;
+}
+.Ed
+.Pp
.Sh RETURN VALUES
A 0 value indicates that the call succeeded. A \-1 return value
indicates an error occurred and