aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/signalvar.h
Commit message (Collapse)AuthorAgeFilesLines
* Split 4.x and 5.x signal handling so that we can keep 4.x signalPeter Wemm2002-10-251-3/+4
| | | | | | | | | | | | | | | | | | | 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
* Put parentheses around function-like macros to shut up warnings.Mark Murray2002-10-231-5/+5
| | | | Notes: svn path=/head/; revision=105776
* Part 1 of KSE-IIIJulian Elischer2002-06-291-2/+2
| | | | | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals.. Notes: svn path=/head/; revision=99072
* CURSIG() is not a macro so rename it cursig().Julian Elischer2002-05-291-1/+1
| | | | | | | Obtained from: KSE tree Notes: svn path=/head/; revision=97526
* Redo the sigio locking.Alfred Perlstein2002-05-011-8/+8
| | | | | | | | | | | | | | Turn the sigio sx into a mutex. Sigio lock is really only needed to protect interrupts from dereferencing the sigio pointer in an object when the sigio itself is being destroyed. In order to do this in the most unintrusive manner change pgsigio's sigio * argument into a **, that way we can lock internally to the function. Notes: svn path=/head/; revision=95883
* Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.Seigo Tanimura2002-04-301-0/+12
| | | | | | | | | | | | | Requested by: bde Since locking sigio_lock is usually followed by calling pgsigio(), move the declaration of sigio_lock and the definitions of SIGIO_*() to sys/signalvar.h. While I am here, sort include files alphabetically, where possible. Notes: svn path=/head/; revision=95759
* Moved signal handling and rescheduling from userret() to ast() so thatBruce Evans2002-04-041-0/+1
| | | | | | | | | | | | | | they aren't in the usual path of execution for syscalls and traps. The main complication for this is that we have to set flags to control ast() everywhere that changes the signal mask. Avoid locking in userret() in most of the remaining cases. Submitted by: luoqi (first part only, long ago, reorganized by me) Reminded by: dillon Notes: svn path=/head/; revision=93793
* Optimized the check for unmasked pending signals in CURSIG() using a newBruce Evans2002-04-041-0/+23
| | | | | | | | | | | | | | inline function sigsetmasked() and a new macro SIGPENDING(). CURSIG() will soon be moved out of the normal path of execution for syscalls and traps. Then its efficiency will be less important but the new interfaces will be useful for checking for unmasked pending signals in more places. Submitted by: luoqi (long ago, in a slightly different form) Assert that sched_lock is not held in CURSIG(). Notes: svn path=/head/; revision=93786
* Remove __PAlfred Perlstein2002-03-191-15/+15
| | | | Notes: svn path=/head/; revision=92719
* Use struct __ucontext in prototypes and associated functions instead ofDaniel Eischen2002-02-171-0/+2
| | | | | | | | | | | | | 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
* KSE Milestone 2Julian Elischer2001-09-121-1/+2
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* style(9) the structure definitions.David E. O'Brien2001-09-051-2/+2
| | | | Notes: svn path=/head/; revision=83045
* *** empty log message ***Peter Wemm2001-08-091-1/+0
| | | | Notes: svn path=/head/; revision=81332
* Declare sigexit() as non-returning.Bruce Evans2000-09-171-5/+5
| | | | | | | Fixed some style bugs. Notes: svn path=/head/; revision=65990
* Uninlined CURSIG() and unpolluted <sys/signalvar.h>. CURSIG() had becomeBruce Evans2000-09-171-36/+1
| | | | | | | | | | | | very bloated, first with 128-bit sigset_t's, then with locking in the SMP case, then with locking in all cases. The space bloat was probably also time bloat, partly because the fast path through CURSIG() was pessimized by the sigset_t changes. This change speeds up lmbench's pipe-based latency benchmark by 4% on a Celeron. <sys/signalvar.h> had become very polluted to support the bloat. Notes: svn path=/head/; revision=65987
* Major update to the way synchronization is done in the kernel. HighlightsJason Evans2000-09-071-2/+6
| | | | | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh Notes: svn path=/head/; revision=65557
* fix warning, declare function static.Alfred Perlstein2000-06-221-1/+1
| | | | | | | Reviewed by: dfr Notes: svn path=/head/; revision=61975
* Functions may be static and __inline, but not extern and __inline. ThisBrian Feldman2000-06-221-1/+1
| | | | | | | should fix broken no-"-O" kernel builds. Notes: svn path=/head/; revision=61940
* The SMP cleanup commit broke UP compiles. Make UP compiles work again.Matthew Dillon2000-03-281-2/+0
| | | | Notes: svn path=/head/; revision=58755
* Commit major SMP cleanups and move the BGL (big giant lock) in theMatthew Dillon2000-03-281-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syscall path inward. A system call may select whether it needs the MP lock or not (the default being that it does need it). A great deal of conditional SMP code for various deadended experiments has been removed. 'cil' and 'cml' have been removed entirely, and the locking around the cpl has been removed. The conditional separately-locked fast-interrupt code has been removed, meaning that interrupts must hold the CPL now (but they pretty much had to anyway). Another reason for doing this is that the original separate-lock for interrupts just doesn't apply to the interrupt thread mechanism being contemplated. Modifications to the cpl may now ONLY occur while holding the MP lock. For example, if an otherwise MP safe syscall needs to mess with the cpl, it must hold the MP lock for the duration and must (as usual) save/restore the cpl in a nested fashion. This is precursor work for the real meat coming later: avoiding having to hold the MP lock for common syscalls and I/O's and interrupt threads. It is expected that the spl mechanisms and new interrupt threading mechanisms will be able to run in tandem, allowing a slow piecemeal transition to occur. This patch should result in a moderate performance improvement due to the considerable amount of code that has been removed from the critical path, especially the simplification of the spl*() calls. The real performance gains will come later. Approved by: jkh Reviewed by: current, bde (exception.s) Some work taken from: luoqi's patch Notes: svn path=/head/; revision=58717
* Fix lots of warnings caused by __sigisempty and __sigseteq being externsPeter Wemm2000-01-081-2/+0
| | | | | | | and later static inlines. Perhaps these should be #ifdef _KERNEL? Notes: svn path=/head/; revision=55617
* Use 'static __inline', not 'extern __inline', for __sigisempty() andJason Evans2000-01-081-2/+2
| | | | | | | | | __sigseteq(). Submitted by: luoqi Notes: svn path=/head/; revision=55584
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"Peter Wemm1999-12-291-2/+2
| | | | | | | | | 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. Notes: svn path=/head/; revision=55205
* Revive ps_usertramp, it's still referenced by COMPAT_SUNOS code.Luoqi Chen1999-10-141-0/+1
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=52238
* Move SIG_HOLD back to signalvar.h.Marcel Moolenaar1999-10-121-12/+9
| | | | | | | | | Fix style bugs and comments while I'm here. Submitted by: bde Notes: svn path=/head/; revision=52160
* Add a per-signal flag to mark handlers registered with osigaction, so weLuoqi Chen1999-10-111-7/+4
| | | | | | | | | | | | | | | | | | can provide the correct context to each signal handler. Fix broken sigsuspend(): don't use p_oldsigmask as a flag, use SAS_OLDMASK as we did before the linuxthreads support merge (submitted by bde). Move ps_sigstk from to p_sigacts to the main proc structure since signal stack should not be shared among threads. Move SAS_OLDMASK and SAS_ALTSTACK flags from sigacts::ps_flags to proc::p_flag. Move PS_NOCLDSTOP and PS_NOCLDWAIT flags from proc::p_flag to procsig::ps_flag. Reviewed by: marcel, jdp, bde Notes: svn path=/head/; revision=52140
* sigset_t change (part 2 of 5)Marcel Moolenaar1999-09-291-75/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------- 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. Notes: svn path=/head/; revision=51791
* General cleanup of core-dumping code.Julian Elischer1999-09-011-1/+0
| | | | | | | Submitted by: Sean Fagan, Notes: svn path=/head/; revision=50717
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* expand_name:Bill Fumerola1999-08-161-2/+2
| | | | | | | | | | use pid_t and uid_t in the declaration as that is what we are passed fix printf formatters accordingly. Reviewed by: green Notes: svn path=/head/; revision=49899
* Implement SA_SIGINFO for i386. Thanks to Bruce Evans for much moreMartin Cracauer1999-07-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=48621
* Enable Linux threads support by default.Julian Elischer1999-01-261-10/+1
| | | | | | | | | | | | This takes the conditionals out of the code that has been tested by various people for a while. ps and friends (libkvm) will need a recompile as some proc structure changes are made. Submitted by: "Richard Seaman, Jr." <dick@tar.com> Notes: svn path=/head/; revision=43208
* Changes to the LINUX_THREADS support to only allocate extra memory forJulian Elischer1999-01-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | shared signal handling when there is shared signal handling being used. This removes the main objection to making the shared signal handling a standard ability in rfork() and friends and 'unconditionalising' this code. (i.e. the allocation of an extra 328 bytes per process). Signal handling information remains in the U area until such a time as it's reference count would be incremented to > 1. At that point a new struct is malloc'd and maintained in KVM so that it can be shared between the processes (threads) using it. A function to check the reference count and move the struct back to the U area when it drops back to 1 is also supplied. Signal information is therefore now swapable for all processes that are not sharing that information with other processes. THis should addres the concerns raised by Garrett and others. Submitted by: "Richard Seaman, Jr." <dick@tar.com> Notes: svn path=/head/; revision=42379
* Reviewed by: Luoqi Chen, Jordan HubbardJulian Elischer1998-12-191-1/+5
| | | | | | | | | | | | | | | Submitted by: "Richard Seaman, Jr." <lists@tar.com> Obtained from: linux :-) Code to allow Linux Threads to run under FreeBSD. By default not enabled This code is dependent on the conditional COMPAT_LINUX_THREADS (suggested by Garret) This is not yet a 'real' option but will be within some number of hours. Notes: svn path=/head/; revision=41931
* Installed the second patch attached to kern/7899 with some changes suggestedDon Lewis1998-11-111-1/+3
| | | | | | | | | | | | | | | | | | | by bde, a few other tweaks to get the patch to apply cleanly again and some improvements to the comments. This change closes some fairly minor security holes associated with F_SETOWN, fixes a few bugs, and removes some limitations that F_SETOWN had on tty devices. For more details, see the description on the PR. Because this patch increases the size of the proc and pgrp structures, it is necessary to re-install the includes and recompile libkvm, the vinum lkm, fstat, gcore, gdb, ipfilter, ps, top, and w. PR: kern/7899 Reviewed by: bde, elvind Notes: svn path=/head/; revision=41086
* Add provisions for variant core dump file formats, depending on theJohn Polstra1998-09-141-1/+4
| | | | | | | | | | | | | | object format of the executable being dumped. This is the first step toward producing ELF core dumps in the proper format. I will commit the code to generate the ELF core dumps Real Soon Now. In the meantime, ELF executables won't dump core at all. That is probably no less useful than dumping a.out-style core dumps as they have done until now. Submitted by: Alex <garbanzo@hooked.net> (with very minor changes by me) Notes: svn path=/head/; revision=39154
* Moved some #includes from <sys/param.h> nearer to where they are actuallyBruce Evans1998-03-281-1/+4
| | | | | | | used. Notes: svn path=/head/; revision=34924
* Forward declare more structs that are used in prototypes here - don'tBruce Evans1998-02-241-1/+3
| | | | | | | depend on <sys/types.h> forward declaring common ones. Notes: svn path=/head/; revision=33777
* remove global prototype for setsigvec(). It's static inside kern_sig.cPeter Wemm1997-08-301-2/+1
| | | | | | | and causes redundant declaration warnings. Notes: svn path=/head/; revision=28933
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=21673
* re-add the ps_signodefer. The interaction between SA_NODEFER and thePeter Wemm1996-03-301-1/+2
| | | | | | | sa_mask was "non intuitive" and broke another of bde's test cases. Notes: svn path=/head/; revision=14926
* Actually implement SA_RESETHAND - some of the sigaction code recognised itPeter Wemm1996-03-151-3/+2
| | | | | | | | | | | | | but didn't actually do anything with it (*blush*). This should fix bde's test case where the test program set SA_RESETHAND and when reading it back, it was gone. Tweak/optimize SA_NODEFER so that the implementation is a little simpler and does not incur (slight) overhead for every signal at delivery time. Notes: svn path=/head/; revision=14630
* Merge in Lite2: add function prototypesJeffrey Hsu1996-03-111-12/+10
| | | | | | | | | | | | | remove bogus function prototype for issig()---no such function fix comment Lite2 changed type of ps_code from int to long. We change it to u_long to make it consistent w/ its usage in kern_sig.c. Did not accept type change to ps_addr field. Delete it instead as it is not used anywhere. Reviewed by: davidg & bde Notes: svn path=/head/; revision=14502
* Mega-commit for Linux emulator update.. This has been stress tested underPeter Wemm1996-03-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=14331
* Improved killproc() log message and made it and the other similar messageDavid Greenman1996-01-311-2/+3
| | | | | | | | tolerant of p_ucred being invalid. Starting using killproc() where appropriate. Notes: svn path=/head/; revision=13788
* A Major staticize sweep. Generates a couple of warnings that I'll dealPoul-Henning Kamp1995-12-141-3/+2
| | | | | | | | | with later. A number of unused vars removed. A number of unused procs removed or #ifdefed. Notes: svn path=/head/; revision=12819
* Moved the prototype for setsigvec() from kern_sig.c to signalvar.h.Bruce Evans1995-11-191-3/+4
| | | | | | | Completed function pointer declarations. Notes: svn path=/head/; revision=12380
* Implement SA_NODEFER sa_flag for sigaction():Steven Wallace1995-10-191-1/+2
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=11573
* Add and move declarations to fix all of the warnings from `gcc -Wimplicit'Bruce Evans1995-03-161-1/+2
| | | | | | | | | (except in netccitt, netiso and netns) and most of the warnings from `gcc -Wnested-externs'. Fix all the bugs found. There were no serious ones. Notes: svn path=/head/; revision=7090