Add a few more functions which are safe to call from signal handlers,

and give a bit of advice.

Obtained from:	OpenBSD
MFC After:	1 week
This commit is contained in:
Kris Kennaway 2001-07-24 08:24:50 +00:00
parent 4bc14ac2f8
commit 057136d2c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80253

View File

@ -418,9 +418,29 @@ Realtime Interfaces:
.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.
In general though, signal handlers should do little more than set a
flag; most other actions are not safe.
.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 RETURN VALUES
A 0 value indicated that the call succeeded. A \-1 return value
indicates an error occurred and