Home | History | Annotate | Download | only in include
History log of /src/include/signal.h
RevisionDateAuthorComments
 1.60  09-Sep-2024  rillig signal.h: sync comment with code, remove trailing whitespace
 1.59  02-Nov-2021  christos Expose sigaltstack, stack_t and friends to Posix Issue 5 (200809L) References:

https://man7.org/linux/man-pages/man2/sigaltstack.2.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html
 1.58  01-Nov-2021  thorpej Version the sigaction(2) libc wrapper. The new version uses the "siginfo"
trampoline exclusively, thus relegating "sigcontext"-style handlers (which
have not been documented for many years now) to the dustbin of the compat
library.
 1.57  08-Jan-2019  joerg Provide global variables with C linkage, otherwise they will create
conflicts for C++ modules use.
 1.56  09-May-2017  kre branches: 1.56.8; 1.56.10;


Add the new signalname/signalnext/signalnumber interface to libc.

This as discussed on current-users in the thread
entitled:
Proposal: new libc/libutil functions to map SIGXXXX <-> "XXXX"
that can be found (starting at):
http://mail-index.netbsd.org/current-users/2017/04/28/msg031600.html

These functions provide the mechanism to enable applications
to divorce themselves from internal details of the signal
implementation.

Libc minor bumped, prototypes in <signal.h>, sets lists updated (and sorted).

One and all: feel free to improve the sources & man page (etc), but
please do not change the function signatures without discussion.
 1.55  31-Jul-2015  kamil branches: 1.55.6;
Do as POSIX says, define the timespec structure in <signal.h>

Extract struct timespec from <sys/time.h> and put into a separate header.

This solution is minimally invasive.
 1.54  27-Aug-2010  christos The signal number argument in psignal is int not unsigned int.
Add psiginfo.
 1.53  31-Jul-2010  joerg Define a new __c99inline macro for compilers known to implement the C99
behavior. This unbreaks GCC 4.4's libgfortran build with the old
signal.h logic, because GCC decided to put the body for the sigsetop
functions in multiple objects.
 1.52  04-May-2010  plunky handle the difference between C99 and GNUC semantics of inline
functions with external linkage, by using "inline" for STDC and
"extern inline" for GNUC

(as noted by joerg@, using static inline may be clearer)
 1.51  11-Jan-2009  christos branches: 1.51.4;
merge christos-time_t
 1.50  03-Mar-2008  dholland branches: 1.50.12;
Add a comment noting that the definition of __errno is now replicated in
signal.h. Per request of joerg@
 1.49  24-Feb-2008  dholland signal.h is not supposed to define errno, so use ___errno instead.
Adjust errno.h in a compatible fashion to avoid -Wredundant-decls issues.
I have run a build to check the tree for places where errno.h is missing,
and fixed the cases I found, but there might be more in MD code.
 1.48  07-Jan-2006  kleink branches: 1.48.10; 1.48.16;
pthread_sigmask(): Add restrict qualifier to set, oset args.
 1.47  27-Dec-2005  perry inline -> __inline for selected things (specifically, the header
file is POSIX visible and the usage isn't #ifdef _KERNEL)

Discussed with core. I may need to go farther than this but for now
compilations done with gcc -ansi (i.e. firefox) will be okay.
 1.46  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.45  15-Sep-2005  drochner use __inline as before, otherwise "gcc -ansi" blows up
 1.44  13-Sep-2005  christos compat code reorg
 1.43  22-Mar-2005  kleink Add restrict qualifiers to remaining <signal.h> function arguments.
 1.42  03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.41  20-Jan-2005  drochner Remove the remains of "struct sigcontext" and sigreturn() from the
user visible namespace.
These weren't supported interfaces for a while (it just happened to
work with COMPAT_16 kernels).
There are still internal uses in compat code and as jmp_buf format,
but this is all md code which uses <machine/signal.h>.
with christos' agreement
 1.40  31-Dec-2004  christos Provide forward struct declarations for struct sigcontext*; this will allow
us to get rid of them in the machine/signal.h files.
 1.39  10-Dec-2004  nathanw Use CPP macros to cause many libpthread functions used by applications
to be transformed into the do-nothing-when-libpthread-isn't-linked libc
stub names. This will permit library code that uses <pthread.h> and pthread
functions "defensively" to not need to link against libpthread and not need
to be patched to the threadlib.h API.
 1.38  01-Jul-2004  kleink Resolve some namespace protection confusion between XPG4.2 and 5/1003.1b,
making _XOPEN_SOURCE_EXTENDED work again. Fixes PR lib/26077.
 1.37  23-May-2004  kleink Implement sigemptyset() and sigfillset() not as macros but as inline
functions, just like the rest of the sigsetops. From J.T.Conklin
in PR lib/25627; originally prompted to work around problems with
an application but also fixing one important bug: per POSIX, these
functions may be additionally implemented as macros, iff they evaluate
their macros only once. This was not the case.
 1.36  12-Sep-2003  christos branches: 1.36.2;
don't put __libc_sigaction14 under __LIBC12_SOURCE__. It is wrong, because
then we have to define __LIBC12_SOURCE__ from __sigaction14_sigtramp.c and
that has the side effect of redefining struct sigaction to the old one.
 1.35  11-Sep-2003  christos s/COMPAT_16/__HAVE_SIGINFO/ pointed out by wiz.
 1.34  11-Sep-2003  christos sigreturn is not visible unless COMPAT_16 is enabled.
 1.33  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.32  18-Jul-2003  nathanw Synchronize the featuretest set for pthreads stuff to
_POSIX_C_SOURCE >= 199506L, _XOPEN_SOURCE >= 500, or _NETBSD_SOURCE.
 1.31  18-Jul-2003  thorpej Back out previous; it is not correct.
 1.30  18-Jul-2003  lukem for now, pull in <pthread_types.h> to get pthread_t for the
pthread_kill() prototype to work ...

this is probably not the correct long term solution, but the tree is
currently broken without it...
 1.29  17-Jul-2003  nathanw Now that sys/types.h defines pthread_t, the forward structure
declaration for pthread_st isn't necessary (and is why I missed that
it was necessary before, as I already had the sys/types.h change in my
local tree).
 1.28  17-Jul-2003  bjh21 Change !_ANSI_SOURCE to _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE.
 1.27  17-Jul-2003  martin Use a forward declaration equivalent to pthread_t instead of the
(undefined here) pthread_t.
 1.26  16-Jul-2003  nathanw Give the pthread_kill() prototype here, as required.
 1.25  28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.24  15-Feb-2003  jdolecek add POSIX sigtimedwait(), sigwaitinfo(), sigwait() - wait for queued signals

note these are for non-threaded programs only - libpthread will provide
it's own thread-aware wrapper
 1.23  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.22  15-Jan-2003  kleink Add sighold(3), sigignore(3), sigrelse(3) and sigset(3) to libc.
Fixes PR lib/19212, now redesignated standards/19212, from David Laight.
 1.21  18-Dec-2000  christos branches: 1.21.2;
protect against multiple declarations. This also fixes a problem where
the inline functions would compile differently depending on if errno.h
was included or not.
 1.20  09-Dec-1998  christos Add /*LINTED*/ comments to sigfillset() and sigemptyset(). (void)sig*set(s);
produced warnings.
 1.19  30-Nov-1998  thorpej Change the type of sys_siglist and sys_signame from const char *const [] to
const char *const *, and rename them to __sys_siglist14 and __sys_signame14.
This will prevent the size of the exported symbol from changing when more
signals are added to the list.
 1.18  24-Oct-1998  kleink Rely on <sys/featuretest.h> defining _REENTRANT if appropriate.
 1.17  01-Oct-1998  kleink In the inlined sigset_t operations, redirect the error indicator assignment via
*__errno() when compiling _REENTRANT (or the like) code.
 1.16  21-Sep-1998  thorpej Declare the size of sys_siglist[] and sys_signame[] to be SIGUSR2+1
instead of _NSIG for now; we need to change these to char **'s, and do
a symbol renaming trick on them, eventually (a'la what Todd did with
libbfd's target match array).
 1.15  13-Sep-1998  thorpej __LIBCxx_SOURCE__ refers to the library major number, not the NetBSD release
number.
 1.14  12-Sep-1998  mycroft Minor KNFing.
 1.13  12-Sep-1998  mycroft Do the syscall versioning.
 1.12  25-May-1998  kleink Reorganize name space protection, mostly related to interfaces introduced in
XPG 4.2.
 1.11  29-Nov-1997  kleink Modify the recent sigaltstack() interface change to use the __RENAME() scheme;
add __sigaltstack14().
 1.10  26-Nov-1997  kleink Update sigaltstack() to use stack_t parameters.
 1.9  18-Nov-1997  kleink Move inclusion of <sys/types.h> before that of <sys/signal.h>.
 1.8  29-Feb-1996  jtc Add prototype for sigaltstack; from John Kohl in PR #2129
 1.7  28-May-1995  jtc Definition equating NSIG to _NSIG has been moved to <sys/signal.h>
 1.6  28-May-1995  jtc Use _NSIG instead of NSIG or constant 32.
Define NSIG equal to _NSIG if !ANSI && !POSIX.
 1.5  10-Jan-1995  jtc Don't include <sys/types.h> if _ANSI_SOURCE is defined.
 1.4  05-Jan-1995  jtc We removed the sigaddset(), sigdelset(), and sigismember() macros, although
they were POSIX.1 compliant, because users have misinterpreted the spec and
have written programs that depend on -1 being returned when a signal number
is out of range. This made initialization of signal masks significantly
more expensive.

This change uses GCC's inline function extension to provide macro-like
signal mask manipulation functions. Since most of the time constants
like SIGINT is used, gcc is able to remove unused range checking code.
Gcc is also smart enough to coalesce adjacent sigemptyset(), sigaddset(),
sigdelset(), and sigfullset() calls into a single assignment.
 1.3  26-Oct-1994  cgd new RCS ID format.
 1.2  12-Aug-1994  jtc Removed macro definitions of sigaddset(), segdelset(), & sigismember()
so that the function implementations (which have invalid signal error
checking) are used.
 1.1  11-May-1994  cgd branches: 1.1.1; 1.1.2;
user-land signal include file
 1.1.2.1  12-Aug-1994  mycroft update from trunk
 1.1.1.1  02-Feb-1998  perry import lite-2
 1.21.2.3  17-Jan-2003  thorpej Sync with HEAD.
 1.21.2.2  16-Jan-2003  thorpej * Move the pthread_sigmask() prototype to <signal.h>.
* Don't include <signal.h> in <pthread.h>.
* Add code to the signal trampoline to convert from the ucontext
to a sigcontext, and back again (XXX though, only callee-save
regs for _UC_USER contexts).

This is necessary in order to support e.g. GCC's libjava, which depends
on the traditional Unix semantics of changes made to the sigcontext
being visible when the handler returns.
 1.21.2.1  02-Oct-2002  thorpej libc:
Internally rename __sigaction14 to __libc_sigaction14. Provide a
weak alias of __sigaction14 -> __libc_sigaction14.

libpthread:
Use __libc_sigaction14 to actually register the signal handler, rather
than using __sigaction_sigtramp() directly with a hard-coded trampoline
version. While we don't actually use the libc trampoline, we want to
avoid depending on any COMPAT_* kernel options down the road (this is
already the case for the VAX port).

Be explicit about which version of the signal interface we're interposing
(...14), and build pthread_sig.c with __LIBC12_SOURCE__ (required to get
the libc-internal interfaces).
 1.36.2.2  02-Jul-2004  he Pull up revision 1.38 (requested by kleink in ticket #579):
Resolve some namespace protection confusion between XPG4.2
and 5/1003.1b, making _XOPEN_SOURCE_EXTENDED work again.
Fixes PR#26077.
 1.36.2.1  25-May-2004  jmc Pullup rev 1.37 (requested by kleink in ticket #381)

Implement sigemptyset() and sigfillset() not as macros but as inline
functions. PR#25627
 1.48.16.1  24-Mar-2008  keiichi sync with head.
 1.48.10.1  23-Mar-2008  matt sync with HEAD
 1.50.12.1  08-Nov-2008  christos changes for 64 bit time_t
 1.51.4.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.51.4.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.55.6.1  11-May-2017  pgoyette Sync with HEAD
 1.56.10.1  10-Jun-2019  christos Sync with HEAD
 1.56.8.1  18-Jan-2019  pgoyette Synch with HEAD

RSS XML Feed