summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
Commit message (Collapse)AuthorAgeFilesLines
* Slight cleanup of some comments/whitespace.julian2002-08-011-6/+23
| | | | | | | | | | | | Make idle process state more consistant. Add an assert on thread state. Clean up idleproc/mi_switch() interaction. Use a local instead of referencing curthread 7 times in a row (I've been told curthread can be expensive on some architectures) Remove some commented out code. Add a little commented out code (completion coming soon) Reviewed by: jhb@freebsd.org
* Don't need to hold schedlock specifically for stop() ans it calls wakeup()julian2002-07-301-6/+1
| | | | | | that locks it anyhow. Reviewed by: jhb@freebsd.org
* revert some of the handling of STOP signals injulian2002-07-241-8/+0
| | | | | | | issignal(). Let thread_suspend_check() actually do the suspension at the user boundary. Submitted by: David Xu <bsddiy@yahoo.com>
* Rearrange the code so that it checks whether the file is somethingtruckman2002-07-101-9/+8
| | | | | | | valid to write a core dump to before doing the preparations to actually write to the file. Call VOP_GETATTR() before dropping the initial vnode lock.
* Try clean up some of the mess that resulted from layers and layersjulian2002-07-031-57/+31
| | | | | | of p4 merges from -current as things started getting different. Corroborated by: Similar patches just mailed by BDE.
* White space commit.julian2002-07-031-10/+10
| | | | | I'm working on this file but I wanted to make the whitespece commit separatly.
* Hold the sched lock across call to forward_signal() in tdsignal() togallatin2002-07-031-1/+4
| | | | | | keep SMP systems from panic'ing when ^C'ing an app suggested by julian
* Part 1 of KSE-IIIjulian2002-06-291-167/+219
| | | | | | | | | | | | | 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..
* more caddr_t removal.alfred2002-06-291-4/+4
|
* - trapsignal() no longer needs to acquire Giant for ktrpsig().jhb2002-06-071-7/+5
| | | | - Catch up to new ktrace API.
* s/!SIGNOTEMPY/SIGISEMPTY/davidc2002-06-061-1/+1
| | | | Reviewed by: marcel, jhb, alfred
* Add POSIX.1-2001 WCONTINUED option for waitpid(2). A proc flagmike2002-06-011-0/+2
| | | | | | | | | | (P_CONTINUED) is set when a stopped process receives a SIGCONT and cleared after it has notified a parent process that has requested notification via waitpid(2) with WCONTINUED specified in its options operand. The status value can be checked with the new WIFCONTINUED() macro. Reviewed by: jake
* CURSIG() is not a macro so rename it cursig().julian2002-05-291-3/+3
| | | | Obtained from: KSE tree
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadjhb2002-05-191-4/+3
| | | | | | | pointer instead of a proc pointer and require the process pointed to by the second argument to be locked. We now use the thread ucred reference for the credential checks in p_can*() as a result. p_canfoo() should now no longer need Giant.
* p_cansignal() returns an errno value; at some point, the check forrwatson2002-05-141-2/+2
| | | | | | | | | | inter-process signalling ceased to preserve and return that value, instead always returning EPERM. This meant that it was possible to "probe" the pid space for processes that were not otherwise visible. This change reverts that reversion. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Remove trace_req().mini2002-05-091-14/+10
| | | | Reviewed by: alfred, jhb, peter
* expand_name fixes:alfred2002-05-081-38/+32
| | | | | | | | | | | | | | | .) don't use MAXPATHLEN + 1, fix logic to compensate. .) style(9) function parameters. .) fix line wrapping. .) remove duplicated error and string handling code. .) don't NUL terminate already NUL terminated string. .) all string length variables changed from int to size_t. .) constify variables. .) catch when corename would be truncated. .) cast pid_t and uid_t args for format string. .) add parens around return arguments. Help and suggestions from: bde
* M_ZERO the temp buffer in expand_name() otherwise if an error occursalfred2002-05-071-1/+1
| | | | | while logging we may pass a non NUL terminated string to log(9) for a %s format arg.
* Return the correct error code (ENOSYS, not EINVAL) from nosys(). Gettingbde2002-05-051-1/+1
| | | | | | | | | killed by SIGSYS for unimlemented syscalls is bad enough. Obtained from: Lite2 branch The Lite2 branch has some other interesting unmerged (?) bits in this file. They are well hidden among cosmetic regressions.
* - Reorder execve() so that it performs blocking operations before itjhb2002-05-021-2/+1
| | | | | | | | locks the process. - Defer other blocking operations such as vrele()'s until after we release locks. - execsigs() now requires the proc lock to be held when it is called rather than locking the process internally.
* Redo the sigio locking.alfred2002-05-011-4/+10
| | | | | | | | | | | 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.
* Avoid the user-visible effect of setting SA_NOCLDWAIT when theiedowse2002-04-271-3/+6
| | | | | | | SIGCHLD handler is SIG_IGN. This is a reimplementation of the problematic revision 1.131 of kern_exit.c. To avoid accessing process UPAGES, we set a new procsig flag when the SIGCHLD handler is SIG_IGN and use that instead.
* Lock proctree_lock instead of pgrpsess_lock.jhb2002-04-161-5/+5
|
* - Change killpg1()'s first argument to be a thread instead of a process sojhb2002-04-131-36/+22
| | | | | | | | | | | | | | | | we can use td_ucred. - In killpg1(), the proc lock is sufficient to check if p_stat is SZOMB or not. We don't need sched_lock. - Close some races in psignal(). In psignal() there is a big switch statement based on p_stat. All the different cases are assuming that the process (or thread) isn't going to change state out from under it. To ensure this is true, just lock sched_lock for the entire switch. We practically held it the entire time already anyways. This also simplifies the locking somewhat and actually results in fewer lock operations. - Allow signotify() to be called with the sched_lock held since psignal() now does that. - Use td_ucred in a couple of places.
* Moved signal handling and rescheduling from userret() to ast() so thatbde2002-04-041-3/+25
| | | | | | | | | | | 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
* Optimized the check for unmasked pending signals in CURSIG() using a newbde2002-04-041-8/+2
| | | | | | | | | | | 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().
* Fixed some style bugs in the removal of __P(()). The main ones werebde2002-03-241-7/+7
| | | | | | not removing tabs before "__P((", and not outdenting continuation lines to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting and/or rewrap the whole prototype in some cases.
* Remove __P.alfred2002-03-191-10/+10
|
* Fix warning in !SMP case.phk2002-02-261-0/+2
| | | | Submitted by: Maxime Henrion <mux@mu.org>
* Lock struct pgrp, session and sigio.tanimura2002-02-231-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* Fixed a typo in rev.1.65 that gave a reference to a nonexistent variable.bde2002-02-151-1/+1
| | | | This was not detected by LINT because LINT is missing COMPAT_SUNOS.
* In a threaded world, differnt priorirites become properties ofjulian2002-02-111-4/+3
| | | | | | different entities. Make it so. Reviewed by: jhb@freebsd.org (john baldwin)
* Add a comment indicating that VOP_GETATTR() is called without appropriaterwatson2002-02-101-0/+2
| | | | locking in the core dump code. This should be fixed.
* Pre-KSE/M3 commit.julian2002-02-071-2/+2
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* o Revert kern_sig.c#1.143, as cr_cansignal() doesn't currently permitrwatson2002-01-101-3/+14
| | | | | | | a number of desirable cases in which SIGIO/SIGURG are delivered. We'll keep tweaking. Reported by: Alexander Kabaev <ak03@gte.com>
* - Teach SIGIO code to use cr_cansignal() instead of a custom CANSIGIO()rwatson2002-01-061-13/+3
| | | | | | | | | | | | | | | | | | | macro. As a result, mandatory signal delivery policies will be applied consistently across the kernel. - Note that this subtly changes the protection semantics, and we should watch out for any resulting breakage. Previously, delivery of SIGIO in this circumstance was limited to situations where the subject was privileged, or where one of the subject's (ruid, euid) matched one of the object's (ruid, euid). In the new scenario, subject (ruid, euid) are matched against the object's (ruid, svuid), and the object uid's must be a subset of the subject uid's. Likewise, jail now affects delivery, and special handling for P_SUGID of the object is present. This change can always be reversed or tweaked if it proves to disrupt application behavior substantially. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Change the preemption code for software interrupt thread schedules andjhb2002-01-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mutex releases to not require flags for the cases when preemption is not allowed: The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent switching to a higher priority thread on mutex releease and swi schedule, respectively when that switch is not safe. Now that the critical section API maintains a per-thread nesting count, the kernel can easily check whether or not it should switch without relying on flags from the programmer. This fixes a few bugs in that all current callers of swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from fast interrupt handlers and the swi_sched of softclock needed this flag. Note that to ensure that swi_sched()'s in clock and fast interrupt handlers do not switch, these handlers have to be explicitly wrapped in critical_enter/exit pairs. Presently, just wrapping the handlers is sufficient, but in the future with the fully preemptive kernel, the interrupt must be EOI'd before critical_exit() is called. (critical_exit() can switch due to a deferred preemption in a fully preemptive kernel.) I've tested the changes to the interrupt code on i386 and alpha. I have not tested ia64, but the interrupt code is almost identical to the alpha code, so I expect it will work fine. PowerPC and ARM do not yet have interrupt code in the tree so they shouldn't be broken. Sparc64 is broken, but that's been ok'd by jake and tmm who will be fixing the interrupt code for sparc64 shortly. Reviewed by: peter Tested on: i386, alpha
* o Wording fix in comment.rwatson2001-12-141-1/+1
| | | | Submitted by: tanimura via p4
* _SIG_MAXSIG (128) is the highest legal signal. The arrays are offsetpeter2001-11-031-2/+2
| | | | | | 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).
* Partial reversion of rev 1.138. kill and killpg allow a signalpeter2001-11-031-2/+2
| | | | | | | | | | argument of 0. You cannot return EINVAL for signal 0. This broke (in 5 minutes of testing) at least ssh-agent and screen. However, there was a bug in the original code. Signal 128 is not valid. Pointy-hat to: des, jhb
* We have a _SIG_VALID() macro, so use it instead of duplicating the test alldes2001-11-021-7/+5
| | | | | | over the place. Also replace a printf() + panic() with a KASSERT(). Reviewed by: jhb
* Fix a typo in do_sigaction() where sa_sigaction and sa_handler wereiedowse2001-10-071-3/+3
| | | | | | | confused. Since sa_sigaction and sa_handler alias each other in a union, the bug was completely harmless. This had been fixed as part of the SIGCHLD changes in revision 1.125, but it was reverted when they were backed out in revision 1.126.
* Lock the vnode while truncating the corefile. This fixes a panicps2001-09-261-0/+2
| | | | | | | with softupdates dangling deps. Submitted by: peter MFC: ASAP :)
* Replace line accidentally deleted during KSE additions.julian2001-09-171-1/+1
| | | | | Symptom.. Stopped program unable to be restarted if it was stopped while already sleeping.
* o Correct authorization check in CANSIGIO(), which suffered from incorrectrwatson2001-09-151-4/+5
| | | | | | | | transcription during the (pcred,ucred) merge; this was not used for the kill() system call, so does not affect direct explicit process signalling. Pointed out by: fenner
* KSE Milestone 2julian2001-09-121-78/+166
| | | | | | | | | | | | | | 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
* This brings in a Yahoo coredump patch from Paul, with additional mods bydillon2001-09-081-4/+19
| | | | | | | | | | | | | | | | | | | me (addition of vn_rdwr_inchunks). The problem Yahoo is solving is that if you have large process images core dumping, or you have a large number of forked processes all core dumping at the same time, the original coredump code would leave the vnode locked throughout. This can cause the directory vnode to get locked up, which can cause the parent directory vnode to get locked up, and so on all the way to the root node, locking the entire machine up for extremely long periods of time. This patch solves the problem in two ways. First it uses an advisory non-blocking lock to abort multiple processes trying to core to the same file. Second (my contribution) it chunks up the writes and uses bwillwrite() to avoid holding the vnode locked while blocking in the buffer cache. Submitted by: ps Reviewed by: dillon MFC after: 2 weeks
* Call sendsig() with the proc lock held and return with it held.jhb2001-09-061-4/+0
|
* Giant Pushdowndillon2001-09-011-37/+133
| | | | | | | | clock_gettime() clock_settime() nanosleep() settimeofday() adjtime() getitimer() setitimer() __sysctl() ogetkerninfo() sigaction() osigaction() sigpending() osigpending() osigvec() osigblock() osigsetmask() sigsuspend() osigsuspend() osigstack() sigaltstack() kill() okillpg() trapsignal() nosys()
* Remove the MPSAFE keyword from the parser for syscalls.master.dillon2001-08-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead introduce the [M] prefix to existing keywords. e.g. MSTD is the MP SAFE version of STD. This is prepatory for a massive Giant lock pushdown. The old MPSAFE keyword made syscalls.master too messy. Begin comments MP-Safe procedures with the comment: /* * MPSAFE */ This comments means that the procedure may be called without Giant held (The procedure itself may still need to obtain Giant temporarily to do its thing). sv_prepsyscall() is now MP SAFE and assumed to be MP SAFE sv_transtrap() is now MP SAFE and assumed to be MP SAFE ktrsyscall() and ktrsysret() are now MP SAFE (Giant Pushdown) trapsignal() is now MP SAFE (Giant Pushdown) Places which used to do the if (mtx_owned(&Giant)) mtx_unlock(&Giant) test in syscall[2]() in */*/trap.c now do not. Instead they explicitly unlock Giant if they previously obtained it, and then assert that it is no longer held to catch broken system calls. Rebuild syscall tables.
OpenPOWER on IntegriCloud