aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/signal.h
Commit message (Collapse)AuthorAgeFilesLines
* Improve MD page fault handlers.Konstantin Belousov2019-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=352807
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326023
* Store a 32-bit PT_LWPINFO struct for 32-bit process core dumps.John Baldwin2017-06-291-0/+42
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=320481
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* Add PROC_TRAPCAP procctl(2) controls and global sysctl kern.trap_enocap.Konstantin Belousov2016-09-211-0/+1
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=306081
* Improve POSIX conformance of <signal.h>.Ed Schouten2016-05-311-1/+22
| | | | | | | | | | | | | | - 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. Notes: svn path=/head/; revision=301071
* POSIX states that #include <signal.h> shall make both mcontext_t andKonstantin Belousov2016-02-121-10/+13
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=295561
* Convert ss_sp in stack_t and sigstack to void *.John Baldwin2016-01-271-3/+2
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=294930
* Register signal 33 explicitly as reserved by real-time library, andRobert Millan2012-03-261-0/+1
| | | | | | | | | | use it by its new name (SIGLIBRT) rather than internal definition in librt (SIGSERVICE). Approved by: davidxu, arch Notes: svn path=/head/; revision=233519
* If multiple threads call kevent() to get AIO events on same kqueue fd,David Xu2012-02-011-0/+2
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=230857
* Make POLL_ERR and POLL_HUP different.Jilles Tjoelker2010-11-121-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=215183
* Add a trap code for DTrace induced traps.Rui Paulo2010-08-241-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=211751
* - According to specification, SI_USER code should only be generated byDavid Xu2010-08-241-0/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=211732
* Remove spurious '/*-' marks and fix some other style problems.Edward Tomasz Napierala2010-07-221-1/+1
| | | | | | | Submitted by: bde@ Notes: svn path=/head/; revision=210365
* Revert r210225 - turns out I was wrong; the "/*-" is not license-onlyEdward Tomasz Napierala2010-07-181-1/+1
| | | | | | | | | | thing; it's also used to indicate that the comment should not be automatically rewrapped. Explained by: cperciva@ Notes: svn path=/head/; revision=210226
* The "/*-" comment marker is supposed to denote copyrights. Remove non-copyrightEdward Tomasz Napierala2010-07-181-1/+1
| | | | | | | occurences from sys/sys/ and sys/kern/. Notes: svn path=/head/; revision=210225
* Implement sighold, sigignore, sigpause, sigrelse, sigset functionsKonstantin Belousov2009-11-261-3/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=199827
* Among signal generation syscalls, only sigqueue(2) is allowed by POSIXKonstantin Belousov2009-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=199355
* Correct the visibility macro surrounding SIGSYS.David Schultz2008-01-191-1/+1
| | | | | | | Submitted by: Andriy Gapon <avg@icyb.net.ua> Notes: svn path=/head/; revision=175502
* Restore member fields sigval_int and sigval_ptr, this unbreaks compilationDavid Xu2007-11-281-0/+3
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=174003
* Remove various bits of conditional Alpha code and fixup a few comments.John Baldwin2006-05-121-1/+1
| | | | Notes: svn path=/head/; revision=158471
* o Remove SI_KERNEL until I really implemented it.David Xu2005-12-081-1/+1
| | | | | | | o Add definition SI_NOINFO for zero si_code. Notes: svn path=/head/; revision=153228
* o Add some pad fields into struct sigevent for future extension.David Xu2005-12-061-2/+14
| | | | | | | | | | (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. Notes: svn path=/head/; revision=153154
* Avoid using signal 127 and 128 as RT signals, these two signals confuseDavid Xu2005-11-301-1/+1
| | | | | | | wait4 interfaces, see PR: kern/19402. Notes: svn path=/head/; revision=152973
* Define SIGLWP which is an alias for SIGTHR, the reason why I did thisDavid Xu2005-11-131-0/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=152373
* Fix name compatible problem with POSIX standard. the sigval_ptr andDavid Xu2005-11-041-3/+3
| | | | | | | | | sigval_int really should be sival_ptr and sival_int. Also sigev_notify_function accepts a union sigval value but not a pointer. Notes: svn path=/head/; revision=152029
* Update SIGTHR's comment.David Xu2005-11-011-1/+1
| | | | Notes: svn path=/head/; revision=151917
* Fix sigevent's POSIX incompatible problem by adding member fieldsDavid Xu2005-10-301-15/+18
| | | | | | | | | | sigev_notify_function and sigev_notify_attributes. AIO syscalls use sigevent, so they have to be adjusted. Reviewed by: alc Notes: svn path=/head/; revision=151867
* Add member fields for POSIX timer.David Xu2005-10-231-0/+6
| | | | Notes: svn path=/head/; revision=151574
* Add POSIX siginfo_t's si_code, this is for upcoming POSIX realtime signalDavid Xu2005-10-141-9/+73
| | | | | | | | | support in kernel. Earlier patch reviewed by: jhb, deischen Notes: svn path=/head/; revision=151306
* Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and renameStefan Farfeleder2005-08-201-0/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=149337
* Make this look less dubious :-)Poul-Henning Kamp2004-06-111-3/+0
| | | | | | | Spotted by: ru Notes: svn path=/head/; revision=130346
* Deorbit COMPAT_SUNOS.Poul-Henning Kamp2004-06-111-3/+0
| | | | | | | | 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. Notes: svn path=/head/; revision=130344
* Remove advertising clause from University of California Regent's license,Warner Losh2004-04-071-4/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core Notes: svn path=/head/; revision=127976
* - According to mike@FreeBSD.org SIGTHR should be hiden byJeff Roberson2003-03-311-3/+2
| | | | | | | #ifdef __BSD_VISIBLE Notes: svn path=/head/; revision=112894
* - Add a signal for thread synchronization. Add an XXX so that maybeJeff Roberson2003-03-311-0/+4
| | | | | | | | someone more knowledgeable on standards defined namespaces may ifdef this out. Notes: svn path=/head/; revision=112885
* Fix drift of the comment about sa_sigaction away from its code.Mike Barcroft2002-12-291-1/+1
| | | | | | | | | Fix English in this comment. Submitted by: bde Notes: svn path=/head/; revision=108402
* sa_handler is in the POSIX namespace (5.0-R candidate).Mike Barcroft2002-12-291-2/+3
| | | | Notes: svn path=/head/; revision=108382
* Remove the <sys/types.h> prerequisite for <ucontext.h> by includingMike Barcroft2002-11-281-0/+1
| | | | | | | | | <sys/_types.h> in <sys/signal.h>. Approved by: re Notes: svn path=/head/; revision=107376
* Split 4.x and 5.x signal handling so that we can keep 4.x signalPeter Wemm2002-10-251-0/+8
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=105950
* style(9)Mike Barcroft2002-10-141-28/+29
| | | | | | | Submitted by: bde (partially) Notes: svn path=/head/; revision=105109
* 1) Although C99 allows implementations to define additional SIG*Mike Barcroft2002-10-141-18/+40
| | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=105106
* o Fix a silly requirement for <machine/signal.h> to be included in theMike Barcroft2002-10-131-49/+70
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=105015
* Change <sys/_sigset.h> to typedef __sigset_t instead of sigset_t, soMike Barcroft2002-10-051-0/+6
| | | | | | | that headers that include it can conditionalize sigset_t's visibility. Notes: svn path=/head/; revision=104504
* o Merge <machine/ansi.h> and <machine/types.h> into a new headerMike Barcroft2002-08-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=102227
* Use <sys/_sigset.h> to get declaration of sigset_t, which has been movedGarrett Wollman2002-06-161-16/+3
| | | | | | | | to a separate header to facilitate its declaration in more than one place. Namespace issues not fixed. Notes: svn path=/head/; revision=98301
* Remove __PAlfred Perlstein2002-03-191-6/+5
| | | | Notes: svn path=/head/; revision=92719
* Use struct __ucontext in prototypes and associated functions instead ofDaniel Eischen2002-02-171-2/+5
| | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=90776
* _SIG_MAXSIG (128) is the highest legal signal. The arrays are offsetPeter Wemm2001-11-031-1/+1
| | | | | | | | | 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). Notes: svn path=/head/; revision=85971
* style(9) the structure definitions.David E. O'Brien2001-09-051-3/+3
| | | | Notes: svn path=/head/; revision=83045