summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-02-03 21:20:40 +0000
committerderaadt <deraadt@openbsd.org>2003-02-03 21:20:40 +0000
commit81f7948bbabc4aeb86718e187b53724d2dc5cffc (patch)
treef40c9058db870410f4608b32a691ba179913772e /lib
parentpad tx buffer out to minimum framelength; based on NetBSD (diff)
downloadwireguard-openbsd-81f7948bbabc4aeb86718e187b53724d2dc5cffc.tar.xz
wireguard-openbsd-81f7948bbabc4aeb86718e187b53724d2dc5cffc.zip
some more functions that are (only on OpenBSD) safe in signal handlers.
not having access to these makes things really painful
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/signal.318
-rw-r--r--lib/libc/sys/sigaction.219
2 files changed, 33 insertions, 4 deletions
diff --git a/lib/libc/gen/signal.3 b/lib/libc/gen/signal.3
index 550e3e5e46a..98248f5bac4 100644
--- a/lib/libc/gen/signal.3
+++ b/lib/libc/gen/signal.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: signal.3,v 1.18 2002/04/30 16:31:42 mpech Exp $
+.\" $OpenBSD: signal.3,v 1.19 2003/02/03 21:20:47 deraadt Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -337,7 +337,7 @@ Extension Interfaces:
.Fn strlcat ,
.Fn syslog_r .
.Pp
-All functions not in the above lists are considered to be unsafe
+Most 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.
@@ -348,6 +348,20 @@ 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.
+.Pp
+A few other functions are signal race safe in
+.Ox
+but probably not on other systems:
+.Pp
+.Bl -tag -offset indent -compact -width foofoofoofoo
+.It Fn snprintf
+Safe as long as $n positional arguments are not used.
+.It Fn syslog_r
+Safe if the
+.Va syslog_data
+struct is initialized as a local variable.
+.El
+.Pp
.Sh RETURN VALUES
The previous action is returned on a successful call.
Otherwise,
diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2
index fc41bf91dac..fff21e5d55d 100644
--- a/lib/libc/sys/sigaction.2
+++ b/lib/libc/sys/sigaction.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sigaction.2,v 1.33 2002/04/30 16:31:42 mpech Exp $
+.\" $OpenBSD: sigaction.2,v 1.34 2003/02/03 21:20:40 deraadt Exp $
.\" $NetBSD: sigaction.2,v 1.7 1995/10/12 15:41:16 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -695,7 +695,8 @@ Extension Interfaces:
.Fn strlcpy ,
.Fn strlcat .
.Pp
-All functions not in the above lists are considered to be unsafe
+.Pp
+Most 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.
@@ -704,6 +705,20 @@ 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.
+.Pp
+A few other functions are signal race safe in
+.Ox
+but probably not on other systems:
+.Pp
+.Bl -tag -offset indent -compact -width foofoofoofoo
+.It Fn snprintf
+Safe as long as $n positional arguments are not used.
+.It Fn syslog_r
+Safe if the
+.Va syslog_data
+struct is initialized as a local variable.
+.El
+.Pp
.Sh SEE ALSO
.Xr kill 1 ,
.Xr kill 2 ,