History log of /freebsd-current/sys/sys/signal.h
Revision Date Author Comments
# 06af7bd1 10-May-2024 Warner Losh <imp@FreeBSD.org>

posix: POSIX-1.2008 moved SA_* from XSI to base standard

Starting with POSIX-1.2008, "The SA_RESETHAND, SA_RESTART, SA_SIGINFO,
SA_NOCLDWAIT, and SA_NODEFER constants are moved from the XSI option to
the Base." Make them so visible.

PR: 275328
Sponsored by: Netflix


# 97acb35b 19-Apr-2024 Konstantin Belousov <kib@FreeBSD.org>

sys/signal.h: move union sigval into dedicated private header sys/_sigval.h

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44867


# 53186bc1 19-Apr-2024 Konstantin Belousov <kib@FreeBSD.org>

sigqueue(2): add impl-specific flag __SIGQUEUE_TID

The flag allows the pid argument to designate a thread from the calling
process. The flag value is carved from the high bit of the signal
number, which slightly changes the ABI of syscall.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44867


# d060b420 18-Mar-2024 Brooks Davis <brooks@FreeBSD.org>

freebsd32: struct siginfo32 -> struct __siginfo32

In the next commit I will update syscalls.master to use struct __siginfo
(which actually exists) so this update will be needed to make
generated files (from make sysent) align.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44380


# fba329a1 18-Mar-2024 Brooks Davis <brooks@FreeBSD.org>

Define stack_t in sys/_sigaltstack.h

The sigaltstack(2) definition needs this type so make it available
without all of sys/signal.h.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44383


# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 6e2caba7 19-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

arm64: Enable the floating-point exception traps

To enable it user-space needs to call feenableexcept().

FPE_FLTIDO has been added as the IDF bit can't be mapped to any existing
FPE code.

Reviewed by: andrew@
Differential revision: https://reviews.freebsd.org/D35247
MFC after: 2 weeks


# cf98bc28 10-Jul-2021 David Chisnall <theraven@FreeBSD.org>

Pass the syscall number to capsicum permission-denied signals

The syscall number is stored in the same register as the syscall return
on amd64 (and possibly other architectures) and so it is impossible to
recover in the signal handler after the call has returned. This small
tweak delivers it in the `si_value` field of the signal, which is
sufficient to catch capability violations and emulate them with a call
to a more-privileged process in the signal handler.

This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for
the static assertion failure on i386.

Approved by: markj (mentor)

Reviewed by: kib, bcr (manpages)

Differential Revision: https://reviews.freebsd.org/D29185


# d2b55828 10-Jul-2021 David Chisnall <theraven@FreeBSD.org>

Revert "Pass the syscall number to capsicum permission-denied signals"

This broke the i386 build.

This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47.


# 3a522ba1 10-Jul-2021 David Chisnall <theraven@FreeBSD.org>

Pass the syscall number to capsicum permission-denied signals

The syscall number is stored in the same register as the syscall return
on amd64 (and possibly other architectures) and so it is impossible to
recover in the signal handler after the call has returned. This small
tweak delivers it in the `si_value` field of the signal, which is
sufficient to catch capability violations and emulate them with a call
to a more-privileged process in the signal handler.

Approved by: markj (mentor)

Reviewed by: kib, bcr (manpages)

Differential Revision: https://reviews.freebsd.org/D29185


# df08823d 27-Sep-2019 Konstantin Belousov <kib@FreeBSD.org>

Improve MD page fault handlers.

Centralize calculation of signal and ucode delivered on unhandled page
fault in new function vm_fault_trap(). MD trap_pfault() now almost
always uses the signal numbers and error codes calculated in
consistent MI way.

This introduces the protection fault compatibility sysctls to all
non-x86 architectures which did not have that bug, but apparently they
were already much more wrong in selecting delivered signals on
protection violations.

Change the delivered signal for accesses to mapped area after the
backing object was truncated. According to POSIX description for
mmap(2):
The system shall always zero-fill any partial page at the end of an
object. Further, the system shall never write out any modified
portions of the last page of an object which are beyond its
end. References within the address range starting at pa and
continuing for len bytes to whole pages following the end of an
object shall result in delivery of a SIGBUS signal.

An implementation may generate SIGBUS signals when a reference
would cause an error in the mapped object, such as out-of-space
condition.
Adjust according to the description, keeping the existing
compatibility code for SIGSEGV/SIGBUS on protection failures.

For situations where kernel cannot handle page fault due to resource
limit enforcement, SIGBUS with a new error code BUS_OBJERR is
delivered. Also, provide a new error code SEGV_PKUERR for SIGSEGV on
amd64 due to protection key access violation.

vm_fault_hold() is renamed to vm_fault(). Fixed some nits in
trap_pfault()s like mis-interpreting Mach errors as errnos. Removed
unneeded truncations of the fault addresses reported by hardware.

PR: 211924
Reviewed by: alc
Discussed with: jilles, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21566


# 51369649 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 51645e83 29-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Store a 32-bit PT_LWPINFO struct for 32-bit process core dumps.

Process core notes for a 32-bit process running on a 64-bit host need to
use 32-bit structures so that the note layout matches the layout of notes
of a core dump of a 32-bit process under a 32-bit kernel.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D11407


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 643f6f47 21-Sep-2016 Konstantin Belousov <kib@FreeBSD.org>

Add PROC_TRAPCAP procctl(2) controls and global sysctl kern.trap_enocap.

Both can be used to cause processes in capability mode to receive
SIGTRAP when ENOTCAPABLE or ECAPMODE errors are returned from
syscalls.

Idea by: emaste
Reviewed by: oshogbo (previous version), emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D7965


# 08c8d10c 31-May-2016 Ed Schouten <ed@FreeBSD.org>

Improve POSIX conformance of <signal.h>.

- This header file has always depended on pthread_t, pthread_attr_t,
struct timespec, size_t and uid_t. Only as of POSIX 2008, these
dependencies have been states explicitly. They should now be defined.

- In our implementation, struct sigevent::sigev_notify_attributes has
type "void *" instead of "pthread_attr_t *". My guess is that this was
done to prevent pulling in the pthread types, but this can easily be
avoided by using the underlying structure types.


# 90edf67e 12-Feb-2016 Konstantin Belousov <kib@FreeBSD.org>

POSIX states that #include <signal.h> shall make both mcontext_t and
ucontext_t available. Our code even has XXX comment about this.

Add a bit of compliance by moving struct __ucontext definition into
sys/_ucontext.h and including it into signal.h and sys/ucontext.h.

Several machine/ucontext.h headers were changed to use namespace-safe
types (like uint64_t->__uint64_t) to not depend on sys/types.h.
struct __stack_t from sys/signal.h is made always visible in private
namespace to satisfy sys/_ucontext.h requirements.

Apparently mips _types.h pollutes global namespace with f_register_t
type definition. This commit does not try to fix the issue.

PR: 207079
Reported and tested by: Ting-Wei Lan <lantw44@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks


# aa949be5 27-Jan-2016 John Baldwin <jhb@FreeBSD.org>

Convert ss_sp in stack_t and sigstack to void *.

POSIX requires these members to be of type void * rather than the
char * inherited from 4BSD. NetBSD and OpenBSD both changed their
fields to void * back in 1998. No new build failures were reported
via an exp-run.

PR: 206503 (exp-run)
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D5092


# 63eebf9c 26-Mar-2012 Robert Millan <rmh@FreeBSD.org>

Register signal 33 explicitly as reserved by real-time library, and
use it by its new name (SIGLIBRT) rather than internal definition
in librt (SIGSERVICE).

Approved by: davidxu, arch


# fde80935 31-Jan-2012 David Xu <davidxu@FreeBSD.org>

If multiple threads call kevent() to get AIO events on same kqueue fd,
it is possible that a single AIO event will be reported to multiple
threads, it is not threading friendly, and the existing API can not
control this behavior.
Allocate a kevent flags field sigev_notify_kevent_flags for AIO event
notification in sigevent, and allow user to pass EV_CLEAR, EV_DISPATCH
or EV_ONESHOT to AIO kernel code, user can control whether the event
should be cleared once it is retrieved by a thread. This change should
be comptaible with existing application, because the field should have
already been zero-filled, and no additional action will be taken by
kernel.

PR: kern/156567


# 414f6985 12-Nov-2010 Jilles Tjoelker <jilles@FreeBSD.org>

Make POLL_ERR and POLL_HUP different.

The kernel currently does not generate any of the POLL_* constants, but
some applications use them and break if they are not all distinct.

PR: kern/126076
MFC after: 1 week


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 12f48a53 24-Aug-2010 Rui Paulo <rpaulo@FreeBSD.org>

Add a trap code for DTrace induced traps.

Sponsored by: The FreeBSD Foundation


# baf28b69 24-Aug-2010 David Xu <davidxu@FreeBSD.org>

- According to specification, SI_USER code should only be generated by
standard kill(). On other systems, SI_LWP is generated by lwp_kill().
This will allow conforming applications to differentiate between
signals generated by standard events and those generated by other
implementation events in a manner compatible with existing practice.
- Bump __FreeBSD_version


# 175389cf 21-Jul-2010 Edward Tomasz Napierala <trasz@FreeBSD.org>

Remove spurious '/*-' marks and fix some other style problems.

Submitted by: bde@


# 1a996ed1 18-Jul-2010 Edward Tomasz Napierala <trasz@FreeBSD.org>

Revert r210225 - turns out I was wrong; the "/*-" is not license-only
thing; it's also used to indicate that the comment should not be automatically
rewrapped.

Explained by: cperciva@


# 805cc58a 18-Jul-2010 Edward Tomasz Napierala <trasz@FreeBSD.org>

The "/*-" comment marker is supposed to denote copyrights. Remove non-copyright
occurences from sys/sys/ and sys/kern/.


# f2d58a1d 31-Jan-2010 Konstantin Belousov <kib@FreeBSD.org>

MFC r199827:
Implement sighold, sigignore, sigpause, sigrelse, sigset functions.

MFC r200881 (by cognet):
Don't name parameters.


# fb70e2f7 18-Dec-2009 Konstantin Belousov <kib@FreeBSD.org>

MFC r199355:
Add SI_KERNEL.

MFC r199418:
Fix pgsignal() call after signature change in r199355.


# 9a6ceace 26-Nov-2009 Konstantin Belousov <kib@FreeBSD.org>

Implement sighold, sigignore, sigpause, sigrelse, sigset functions
from SUSv4 XSI. Note that the functions are obsoleted, and only
provided to ease porting from System V-like systems. Since sigpause
already exists in compat with different interface, XSI sigpause is
named xsi_sigpause.

Reviewed by: davidxu
MFC after: 3 weeks


# a3de221d 17-Nov-2009 Konstantin Belousov <kib@FreeBSD.org>

Among signal generation syscalls, only sigqueue(2) is allowed by POSIX
to fail due to lack of resources to queue siginfo. Add KSI_SIGQ flag
that allows sigqueue_add() to fail while trying to allocate memory for
new siginfo. When the flag is not set, behaviour is the same as for
KSI_TRAP: if memory cannot be allocated, set bit in sq_kill. KSI_TRAP is
kept to preserve KBI.

Add SI_KERNEL si_code, to be used in siginfo.si_code when signal is
generated by kernel. Deliver siginfo when signal is generated by kill(2)
family of syscalls (SI_USER with properly filled si_uid and si_pid), or
by kernel (SI_KERNEL, mostly job control or SIGIO). Since KSI_SIGQ flag
is not set for the ksi, low memory condition cause old behaviour.

Keep psignal(9) KBI intact, but modify it to generate SI_KERNEL
si_code. Pgsignal(9) and gsignal(9) now take ksi explicitely. Add
pksignal(9) that behaves like psignal but takes ksi, and ddb kill
command implemented as pksignal(..., ksi = NULL) to not do allocation
while in debugger.

While there, remove some register specifiers and use ANSI C prototypes.

Reviewed by: davidxu
MFC after: 1 month


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2d6d5e16 19-Jan-2008 David Schultz <das@FreeBSD.org>

Correct the visibility macro surrounding SIGSYS.

Submitted by: Andriy Gapon <avg@icyb.net.ua>


# 2f294b2a 27-Nov-2007 David Xu <davidxu@FreeBSD.org>

Restore member fields sigval_int and sigval_ptr, this unbreaks compilation
of some old programs. Since sigval is union type, this change will not have
binary compatibility problem.

MFC: after 3 days
Discussed with: rwatson, glebius


# 73dbd3da 11-May-2006 John Baldwin <jhb@FreeBSD.org>

Remove various bits of conditional Alpha code and fixup a few comments.


# ac989516 08-Dec-2005 David Xu <davidxu@FreeBSD.org>

o Remove SI_KERNEL until I really implemented it.
o Add definition SI_NOINFO for zero si_code.


# 1a2d6e30 05-Dec-2005 David Xu <davidxu@FreeBSD.org>

o Add some pad fields into struct sigevent for future extension.
(suggested by alfred@)
o Reuse si_band field in struct __siginfo, add a mqd member which will
be used by mqueue.
o Add code SI_KERNEL to indicate a signal is queued by kernel.


# 045d4ae3 30-Nov-2005 David Xu <davidxu@FreeBSD.org>

Avoid using signal 127 and 128 as RT signals, these two signals confuse
wait4 interfaces, see PR: kern/19402.


# 72ebfcd7 13-Nov-2005 David Xu <davidxu@FreeBSD.org>

Define SIGLWP which is an alias for SIGTHR, the reason why I did this
is that gdb knows SIGLWP and will pass it to program, otherwise gdb
will print out "unknown signal" and discard it, and then thread
cancellation won't work for libthr under gdb.

MFC: 3 days


# 8f0371f1 04-Nov-2005 David Xu <davidxu@FreeBSD.org>

Fix name compatible problem with POSIX standard. the sigval_ptr and
sigval_int really should be sival_ptr and sival_int.
Also sigev_notify_function accepts a union sigval value but not a
pointer.


# 7bde3748 31-Oct-2005 David Xu <davidxu@FreeBSD.org>

Update SIGTHR's comment.


# 0972628a 29-Oct-2005 David Xu <davidxu@FreeBSD.org>

Fix sigevent's POSIX incompatible problem by adding member fields
sigev_notify_function and sigev_notify_attributes. AIO syscalls
use sigevent, so they have to be adjusted.

Reviewed by: alc


# 575c4ead 22-Oct-2005 David Xu <davidxu@FreeBSD.org>

Add member fields for POSIX timer.


# ac2587e1 13-Oct-2005 David Xu <davidxu@FreeBSD.org>

Add POSIX siginfo_t's si_code, this is for upcoming POSIX realtime signal
support in kernel.

Earlier patch reviewed by: jhb, deischen


# a1f85d7f 20-Aug-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and rename
it to __MINSIGSTKSZ. Define MINSIGSTKSZ in <sys/signal.h>.

This is done in order to use MINSIGSTKSZ for the macro PTHREAD_STACK_MIN
in <pthread.h> (soon <limits.h>) without having to include the whole
<sys/signal.h> header.

Discussed with: bde


# a2befd2a 11-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Make this look less dubious :-)

Spotted by: ru


# 1930e303 11-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Deorbit COMPAT_SUNOS.

We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither
a sparc32 port nor a SunOS4.x compatibility desire these days.


# 82c6e879 06-Apr-2004 Warner Losh <imp@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core


# 55d9ba3e 31-Mar-2003 Jeff Roberson <jeff@FreeBSD.org>

- According to mike@FreeBSD.org SIGTHR should be hiden by
#ifdef __BSD_VISIBLE


# 90176341 31-Mar-2003 Jeff Roberson <jeff@FreeBSD.org>

- Add a signal for thread synchronization. Add an XXX so that maybe
someone more knowledgeable on standards defined namespaces may ifdef
this out.


# 38dbec43 29-Dec-2002 Mike Barcroft <mike@FreeBSD.org>

Fix drift of the comment about sa_sigaction away from its code.
Fix English in this comment.

Submitted by: bde


# 17d44bff 28-Dec-2002 Mike Barcroft <mike@FreeBSD.org>

sa_handler is in the POSIX namespace (5.0-R candidate).


# dda9f924 28-Nov-2002 Mike Barcroft <mike@FreeBSD.org>

Remove the <sys/types.h> prerequisite for <ucontext.h> by including
<sys/_types.h> in <sys/signal.h>.

Approved by: re


# 23eeeff7 25-Oct-2002 Peter Wemm <peter@FreeBSD.org>

Split 4.x and 5.x signal handling so that we can keep 4.x signal
handling clean and functional as 5.x evolves. This allows some of the
nasty bandaids in the 5.x codepaths to be unwound.

Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an
anti-foot-shooting measure in place, 5.x folks need this for a while) and
finish encapsulating the older stuff under COMPAT_43. Since the ancient
stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *'
to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn
is supposed to take), add a compile time check to prevent foot shooting
there too. Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc.

Tested on: i386, alpha, ia64. Compiled on sparc64 (a few days ago).
Approved by: re


# a1facc57 14-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

style(9)

Submitted by: bde (partially)


# 5f0aea5c 14-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

1) Although C99 allows implementations to define additional SIG*
constants in scope, C90 does not; so, add namespace visibility
conditionals to SIG*.
2) Define the extended __sighandler_t type only in BSD namespace.
3) Don't forward declare a struct for a prototype in <signal.h>.
4) Move location of SIG_* constants.
5) Move a forward declare into the correct namespace conditional.

Requested by: bde (1)
Submitted by: bde (2 thru 5)


# 1b5ce81c 12-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

o Fix a silly requirement for <machine/signal.h> to be included in the
middle of this header.
o Remove unneeded conditionals to hide SIG* in the POSIX case.
(C allows implementations to define additional SIG* constants.)
o Add comments about missing features.
o Move the location of the sigset_t typedef.
o Update standards visibility conditionals.
o Fix some assumptions about what pid_t and uid_t are defined as.
o Remove size_t typedef and use __size_t in struct sigaltstack
instead.


# 229aeecb 04-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

Change <sys/_sigset.h> to typedef __sigset_t instead of sigset_t, so
that headers that include it can conditionalize sigset_t's visibility.


# abbd8902 21-Aug-2002 Mike Barcroft <mike@FreeBSD.org>

o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif

Concept by: bde
Reviewed by: jake, obrien


# e055075e 16-Jun-2002 Garrett Wollman <wollman@FreeBSD.org>

Use <sys/_sigset.h> to get declaration of sigset_t, which has been moved
to a separate header to facilitate its declaration in more than one
place. Namespace issues not fixed.


# 789f12fe 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P


# 0270d57a 17-Feb-2002 Daniel Eischen <deischen@FreeBSD.org>

Use struct __ucontext in prototypes and associated functions instead of
ucontext_t. Forward declare struct __ucontext in <sys/signal.h> and
remove reliance on <sys/ucontext.h> being included.

While I'm here, also hide osigcontext types from userland; suggested
by bde.

Namespace pollution noticed by: Kevin Day <toasty@shell.dragondata.com>


# 6c1534a7 03-Nov-2001 Peter Wemm <peter@FreeBSD.org>

_SIG_MAXSIG (128) is the highest legal signal. The arrays are offset
by one - see _SIG_IDX(). Revert part of my mis-correction in kern_sig.c
(but signal 0 still has to be allowed) and fix _SIG_VALID() (it was
rejecting ignal 128).


# 5752bffd 04-Sep-2001 David E. O'Brien <obrien@FreeBSD.org>

style(9) the structure definitions.


# 2f3cf918 18-Apr-2001 Alfred Perlstein <alfred@FreeBSD.org>

Check validity of signal callback requested via aio routines.

Also move the insertion of the request to after the request is validated,
there's still looks like there may be some problems if an invalid address
is passed to the aio routines, basically a possible leak or having a
not completely initialized structure on the queue may still be possible.

A new sig macro was made _SIG_VALID to check the validity of a signal,
it would be advisable to use it from now on (in kern/kern_sig.c) rather
than rolling your own.

PR: kern/17152


# c6fa9f78 21-Nov-2000 Alan Cox <alc@FreeBSD.org>

Provide a new interface for the user of aio_read() and aio_write() to request
a kevent upon completion of the I/O. Specifically, introduce a new type
of sigevent notification, SIGEV_EVENT. If sigev_notify is SIGEV_EVENT,
then sigev_notify_kqueue names the kqueue that should receive the event
and sigev_value contains the "void *" is copied into the kevent's udata
field.

In contrast to the existing interface, this one: 1) works on
the Alpha 2) avoids the extra copyin() call for the kevent because all
of the information needed is in the sigevent and 3) could be
applied to request a single kevent upon completion of an entire lio_listio().

Reviewed by: jlemon


# 806d7daa 09-Nov-2000 Marcel Moolenaar <marcel@FreeBSD.org>

Make MINSIGSTKSZ machine dependent, and have the sigaltstack
syscall compare against a variable sv_minsigstksz in struct
sysentvec as to properly take the size of the machine- and
ABI dependent struct sigframe into account.

The SVR4 and iBCS2 modules continue to have a minsigstksz of
8192 to preserve behavior. The real values (if different) are
not known at this time. Other ABI modules use the real
values.

The native MINSIGSTKSZ is now defined as follows:

Arch MINSIGSTKSZ
---- -----------
alpha 4096
i386 2048
ia64 12288

Reviewed by: mjacob
Suggested by: bde


# 664a31e4 28-Dec-1999 Peter Wemm <peter@FreeBSD.org>

Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot). This is consistant with the other
BSD's who made this change quite some time ago. More commits to come.


# ea00c934 15-Oct-1999 Marcel Moolenaar <marcel@FreeBSD.org>

Properly fix building posix sources this time.

Reported by: markm


# c981e3f9 12-Oct-1999 Marcel Moolenaar <marcel@FreeBSD.org>

Move SIG_HOLD back to signalvar.h.

Fix style bugs and comments while I'm here.

Submitted by: bde


# 7b92e923 10-Oct-1999 Poul-Henning Kamp <phk@FreeBSD.org>

I don't know if this is the correct fix, but my kernel can compile with it.


# d348b4d2 10-Oct-1999 Marcel Moolenaar <marcel@FreeBSD.org>

Use the proper #ifdef around union sigval and siginfo_t. This fixes
the breakage of POSIX sources (such as XFree86).

Reviewed by: bde


# c5c6b7b3 04-Oct-1999 Marcel Moolenaar <marcel@FreeBSD.org>

Re-introduction of sigcontext.

struct sigcontext and ucontext_t/mcontext_t are defined in such
a way that both (ie struct sigcontext and ucontext_t) can be
passed on to sigreturn. The signal handler is still given a
ucontext_t for maximum flexibility.

For backward compatibility sigreturn restores the state for the
alternate signal stack from sigcontext.sc_onstack and not from
ucontext_t.uc_stack. A good way to determine which value the
application has set and thus which value to use, is still open
for discussion.

NOTE: This change should only affect those binaries that use
sigcontext and/or ucontext_t. In the source tree itself
this is only doscmd. Recompilation is required for those
applications.

This commit also fixes a lot of style bugs without hopefully
adding new ones.

NOTE: struct sigaltstack.ss_size now has type size_t again. For
some reason I changed that into unsigned int.

Parts submitted by: bde
sigaltstack bug found by: bde


# 2c42a146 29-Sep-1999 Marcel Moolenaar <marcel@FreeBSD.org>

sigset_t change (part 2 of 5)
-----------------------------

The core of the signalling code has been rewritten to operate
on the new sigset_t. No methodological changes have been made.
Most references to a sigset_t object are through macros (see
signalvar.h) to create a level of abstraction and to provide
a basis for further improvements.

The NSIG constant has not been changed to reflect the maximum
number of signals possible. The reason is that it breaks
programs (especially shells) which assume that all signals
have a non-null name in sys_signame. See src/bin/sh/trap.c
for an example. Instead _SIG_MAXSIG has been introduced to
hold the maximum signal possible with the new sigset_t.

struct sigprop has been moved from signalvar.h to kern_sig.c
because a) it is only used there, and b) access must be done
though function sigprop(). The latter because the table doesn't
holds properties for all signals, but only for the first NSIG
signals.

signal.h has been reorganized to make reading easier and to
add the new and/or modified structures. The "old" structures
are moved to signalvar.h to prevent namespace polution.

Especially the coda filesystem suffers from the change, because
it contained lines like (p->p_sigmask == SIGIO), which is easy
to do for integral types, but not for compound types.

NOTE: kdump (and port linux_kdump) must be recompiled.

Thanks to Garrett Wollman and Daniel Eischen for pressing the
importance of changing sigreturn as well.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# aff66c54 06-Jul-1999 Martin Cracauer <cracauer@FreeBSD.org>

Implement SA_SIGINFO for i386. Thanks to Bruce Evans for much more
than a review, this was a nice puzzle.

This is supposed to be binary and source compatible with older
applications that access the old FreeBSD-style three arguments to a
signal handler.

Except those applications that access hidden signal handler arguments
bejond the documented third one. If you have applications that do,
please let me know so that we take the opportunity to provide the
functionality they need in a documented manner.

Also except application that use 'struct sigframe' directly. You need
to recompile gdb and doscmd. `make world` is recommended.

Example program that demonstrates how SA_SIGINFO and old-style FreeBSD
handlers (with their three args) may be used in the same process is at
http://www3.cons.org/tmp/fbsd-siginfo.c

Programs that use the old FreeBSD-style three arguments are easy to
change to SA_SIGINFO (although they don't need to, since the old style
will still work):

Old args to signal handler:
void handler_sn(int sig, int code, struct sigcontext *scp)

New args:
void handler_si(int sig, siginfo_t *si, void *third)
where:
old:code == new:second->si_code
old:scp == &(new:si->si_scp) /* Passed by value! */

The latter is also pointed to by new:third, but accessing via
si->si_scp is preferred because it is type-save.

FreeBSD implementation notes:
- This is just the framework to make the interface POSIX compatible.
For now, no additional functionality is provided. This is supposed
to happen now, starting with floating point values.
- We don't use 'sigcontext_t.si_value' for now (POSIX meant it for
realtime-related values).
- Documentation will be updated when new functionality is added and
the exact arguments passed are determined. The comments in
sys/signal.h are meant to be useful.

Reviewed by: BDE


# f68b7c5b 05-Aug-1998 Doug Rabson <dfr@FreeBSD.org>

Define ss_size in struct sigaltstack as size_t instead of int.


# 8a6472b7 28-Mar-1998 Peter Dufault <dufault@FreeBSD.org>

Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work. Changes:

Change all "posix4" to "p1003_1b". Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.


# 245f17d4 13-Sep-1997 Joerg Wunsch <joerg@FreeBSD.org>

Implement SA_NOCLDWAIT.

The implementation is done (unlike what i've originally been
contemplating) by reparenting kids of processes that have the
appropriate bit set to PID 1, and let PID 1 handle the zombie. This
is far less problematical than what would seem to be ``doing it
right'', for a number of reasons.

Of our currently shipping PID-1-intended programs, 50 % fail the above
assumption. ;-) (Read this: sysinstall doesn't do it right. This is
no problem as long as no program called by sysinstall actually uses
SA_NOCLDWAIT.)

ToDo: . clarify the correct SA_* flag inheritance, compared
to other systems,
. decide whether the compat cruft (osigvec(9)) should
deal with new system additions or not,
. merge OpenBSD's SA_SIGINFO implementation. ;)
Reviewed by: bde


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# dc7dfe89 30-Mar-1996 Peter Wemm <peter@FreeBSD.org>

Add a SV_NODEFER and SV_RESETHAND #define, after Bruce pointed out that
a program that was saving and restoring a signal via sigvec() was not
doing the complete job if either of these bits had been set via sigaction.


# 02e2c406 11-Mar-1996 Peter Wemm <peter@FreeBSD.org>

Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all
files are off the vendor branch, so this should not change anything.

A "U" marker generally means that the file was not changed in between
the 4.4Lite and Lite-2 releases, and does not need a merge. "C" generally
means that there was a change.
[new sys/syscallargs.h file, to be "cvs rm"ed]


# d3fa7364 10-Mar-1996 Jeffrey Hsu <hsu@FreeBSD.org>

Merge in Lite2: no changes necessary. Just update CSRG id.
Reviewed by: davidg & bde


# d66a5066 02-Mar-1996 Peter Wemm <peter@FreeBSD.org>

Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)

I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.

The main changes:

COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".

A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.

linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.

Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.

The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.

Supporting changes elsewhere in the kernel:

The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.

The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.

makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)

At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.


# 86cfd0dd 21-Jan-1996 Mike Pritchard <mpp@FreeBSD.org>

Changed the description of SIGSYS to better reflect what
it means when that signal is received. Closes PR# 686.


# 1e41c1b5 19-Oct-1995 Steven Wallace <swallace@FreeBSD.org>

Implement SA_NODEFER sa_flag for sigaction():
Add SA_NODEFER define to signal.h
Add ps_nodefer field to struct sigacts in signalvar.h.
Add code to kern_sig.c to handle SA_NODEFER.

If flag is set, when the signal is delivered, it is not masked automatically
from receiving the same signal again.

Reviewed by: wollman, bde


# 943c1801 27-Jun-1995 Bruce Evans <bde@FreeBSD.org>

Fix standards conformance bugs in <signal.h>:

include/signal.h:
There was massive namespace pollution from including <sys/types.h>.
POSIX functions were declared even when _ANSI_SOURCE is defined.

sys.sys/signal.h:
NSIG was declared even if _ANSI_SOURCE or _POSIX_SOURCE is defined.
sig_atomic_t wasn't declared if _POSIX_SOURCE is defined.
Declare a typedef for signal handling functions and use it to
unobfuscate declarations and to avoid half-baked function types
that cause unwanted compiler warnings at certain warning levels.
Fix confusing comment about SA_RESTART.

sys/i386/include/signal.h:
This has to be included to get the declaration of sig_atomic_t even
when _ANSI_SOURCE is defined, so be more careful about polluting
the ANSI namespace.

Uniformize idempotency ifdefs.


# aa98692f 28-Jan-1995 Andreas Schulz <ats@FreeBSD.org>

Correct a name of one structure member in the sigaltstack structure.
Now it matches the man page and also the only other commercial implementation
i have found so far ( Solaris 2.x).
Changed the name from ss_base to ss_sp.


# 3c4dd356 02-Aug-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# df8bae1d 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Kernel Sources