summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
Commit message (Collapse)AuthorAgeFilesLines
* Assert process lock in ptracestop(), since we're going to relyrwatson2004-01-291-0/+1
| | | | on it, and later unlock it.
* Move the part of the comment which applies to osigsuspend wherekan2004-01-281-2/+5
| | | | | | | it belongs. The current sigsuspend syscall does expect a pointer to the mask as argument. Submitted by: Igor Sysoev <is at rambler-co dot ru>
* - Add a flags parameter to mi_switch. The value of flags may be SW_VOL orjeff2004-01-251-4/+2
| | | | | | | | | | SW_INVOL. Assert that one of these is set in mi_switch() and propery adjust the rusage statistics. This is to simplify the large number of users of this interface which were previously all required to adjust the proper counter prior to calling mi_switch(). This also facilitates more switch and locking optimizations. - Change all callers of mi_switch() to pass the appropriate paramter and remove direct references to the process statistics.
* When not creating a core dump due to resource limits specifyingrwatson2004-01-111-1/+1
| | | | | | | | | | | a maximum dump size of 0, return a size-related error, rather than returning success. Otherwise, waitpid() will incorrectly return a status indicating that a core dump was created. Note that the specific error doesn't actually matter, since it's lost. MFC after: 2 weeks PR: 60367 Submitted by: Valentin Nechayev <netch@netch.kiev.ua>
* Drop the sigacts mutex around calls to stopevent() to avoid sleepingrwatson2004-01-081-2/+10
| | | | | | | | | holding the mutex. Because the sigacts pointer can't change while the process is "live" (proc locking (x)), we know our pointer is still valid. In communication with: truckman Reviewed by: jhb
* Make sigaltstack as per-threaded, because per-process sigaltstack statedavidxu2004-01-031-37/+28
| | | | | | | | | | | | | is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Reviewed by: deischen, dfr
* Lock and unlock sched_lock when walking through thread list, current wedavidxu2003-12-071-1/+11
| | | | | insert kse upcall thread into thread list at mi_switch time, process lock is not enough.
* Try to fetch thread mailbox address in page fault trap, so when threaddavidxu2003-10-301-1/+2
| | | | | blocks in page fault hanlder, and upcall thread can be scheduled. It is useful if process is doing lots of mmap based I/O.
* Check (locked) before performing an advisory unlock following a failurerwatson2003-10-251-1/+2
| | | | | | | of vn_start_write(). Otherwise, we may inconsistently attempt to release the advisory lock. Pointed out by: teggej
* When generate a core dump, use advisory locking in an advisory way:rwatson2003-10-251-6/+6
| | | | | | | | | | | if we do acquire an advisory lock, great! We'll release it later. However, if we fail to acquire a lock, we perform the coredump anyway. This problem became particularly visible with NFS after the introduction of rpc.lockd: if the lock manager isn't running, then locking calls will fail, aborting the core dump (resulting in a zero-byte dump file). Reported by: Yogeshwar Shenoy <ynshenoy@alumni.cs.ucsb.edu>
* Don't clear signal mask in execsig(). RELENG_4 does not clear it and POSIXdavidxu2003-10-131-4/+0
| | | | asks to inherit signal mask for execv.
* Move some tracing related code into its own function as it willrobert2003-09-261-15/+24
| | | | | be needed for system call related ptrace functionality I plan to commit soon.
* panic() if we try to handle an out-of-range signal number innectar2003-08-101-2/+5
| | | | | | | | psignal()/tdsignal(). The test was historically in psignal(). It was changed into a KASSERT, and then later moved to tdsignal() when the latter was introduced. Reviewed by: iedowse, jhb
* Use correct signal when calling sigexit.davidxu2003-07-301-1/+3
|
* Add fdidx argument to vn_open() and vn_open_cred() and pass -1 throughout.phk2003-07-271-1/+1
|
* The POSIX spec also requires that kern_sigtimedwait returnmtm2003-07-241-1/+1
| | | | EINVAL if tv_nsec of the timeout is less than zero.
* Always deliver synchronous signal to UTS for SA threads.davidxu2003-07-211-2/+14
|
* Fix sigwait to conform to POSIX.davidxu2003-07-171-67/+109
| | | | | | | | | | | When a signal is being delivered to process, first find a sigwait thread to deliver, POSIX's argument is speed of delivering signal to sigwait thread is faster than other ways. A signal in its wait set will cause sigwait to return the signal number, a signal not in its wait set but in not blocked by the thread also causes sigwait to return, but sigwait returns EINTR, sigwait is oneshot operation, only one signal can be delivered to its wait set, when a signal is delivered to the sigwait thread, the thread's sigwait state is canceled.
* Rename thread_siginfo to cpu_thread_siginfodavidxu2003-07-151-1/+1
|
* If a thread is sending signal to its process, if the thread can handledavidxu2003-07-111-3/+4
| | | | the signal itself, it should get it without looking for other threads.
* Make the conditional, which decides what siglist to put a signal on,mtm2003-07-051-8/+5
| | | | | | more concise and improve the comment. Submitted by: bde
* Signals sent specifically to a particular thread mustmtm2003-07-031-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | be delivered to that thread, regardless of whether it has it masked or not. Previously, if the targeted thread had the signal masked, it would be put on the processes' siglist. If another thread has the signal umasked or unmasks it before the target, then the thread it was intended for would never receive it. This patch attempts to solve the problem by requiring callers of tdsignal() to say whether the signal is for the thread or for the process. If it is for the process, then normal processing occurs and any thread that has it unmasked can receive it. But if it is destined for a specific thread, it is put on that thread's pending list regardless of whether it is currently masked or not. The new behaviour still needs more work, though. If the signal is reposted for some reason it is always posted back to the thread that handled it because the information regarding the target of the signal has been lost by then. Reviewed by: jdp, jeff, bde (style)
* o Change kse_thr_interrupt to allow send a signal to a specified thread,davidxu2003-06-281-8/+88
| | | | | | | | | | | | | | | | | or unblock a thread in kernel, and allow UTS to specify whether syscall should be restarted. o Add ability for UTS to monitor signal comes in and removed from process, the flag PS_SIGEVENT is used to indicate the events. o Add a KMF_WAITSIGEVENT for KSE mailbox flag, UTS call kse_release with this flag set to wait for above signal event. o For SA based thread, kernel masks all signal in its signal mask, let UTS to use kse_thr_interrupt interrupt a thread, and install a signal frame in userland for the thread. o Add a tm_syncsig in thread mailbox, when a hardware trap occurs, it is used to deliver synchronous signal to userland, and upcall is schedule, so UTS can process the synchronous signal for the thread. Reviewed by: julian (mentor)
* Fix POSIX compatible bug for sigwaitinfo and sigtimedwait.davidxu2003-06-281-4/+11
| | | | | | | POSIX says siginfo pointer parameter can be NULL and if the function success, it should return signal number but not zero. The waitset it past should be negatived before it can be used as thread signal mask.
* When a STOP signal is being sent to a process, it is possible alldavidxu2003-06-201-2/+16
| | | | | | | threads in the process have already masked the signal, so job control is delayed. But later a thread unmasking the STOP signal should enable job control, so in issignal(), scanning all threads in process to see if we can direct suspend some of them, not just suspend current thread.
* Fix typo. td should be td0.davidxu2003-06-201-1/+1
|
* 1. Add code to support bound thread. when blocked, a bound thread neverdavidxu2003-06-151-1/+1
| | | | | | | schedules an upcall. Signal delivering to a bound thread is same as non-threaded process. This is intended to be used by libpthread to implement PTHREAD_SCOPE_SYSTEM thread. 2. Simplify kse_release() a bit, remove sleep loop.
* Rename P_THREADED to P_SA. P_SA means a process is using schedulerdavidxu2003-06-151-1/+1
| | | | activations.
* Use __FBSDID().obrien2003-06-111-1/+3
|
* - Add a td_pflags field to struct thread for private flags accessed only byjhb2003-06-091-12/+6
| | | | | | | | curthread. Unlike td_flags, this field does not need any locking. - Replace the td_inktr and td_inktrace variables with equivalent private thread flags. - Move TDF_OLDMASK over to the private flags field so it no longer requires sched_lock.
* Fix long standing bug that prevents the PT_CONTINUE, PT_KILL andobrien2003-05-161-9/+10
| | | | | | | | | | | | | | | | PT_DETACH ptrace(2) requests from functioning as advertised in the manual page. As described in kern/35175, the PT_DETACH request will, under certain circumstances, pass an unwanted signal on to the traced process upan detaching from it. The PT_CONTINUE request will sometimes fail if you make it pass a signal that has "properties" that differ from the properties of the signal that origionally caused the traced process to be stopped. Since PT_KILL is nothing than PT_CONTINUE with SIGKILL, it is broken too. In the PT_KILL case, this leads to an unkillable process. PR: 44011 Submitted by: Mark Kettenis <kettenis@chello.nl> Approved by: re(jhb)
* - Merge struct procsig with struct sigacts.jhb2003-05-131-81/+161
| | | | | | | | | | | | | | | | | - Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson)
* Remove Giant from kern_sigsuspend() and osigsuspend() as these should nowjhb2003-05-091-10/+2
| | | | | | be MP safe. Approved by: re (scottl)
* Mostly sort the includes.jhb2003-05-051-13/+13
|
* Lock the proc lock around calls to tdsignal() in the sigwait() family ofjhb2003-05-051-6/+12
| | | | syscalls.
* Make issignal() private to kern_sig.c since it is only called from cursig()jhb2003-05-051-1/+2
| | | | and cursig() is now a function rather than a macro.
* Forgot to remove Giant around call to kern_sigaction() injhb2003-04-301-4/+1
| | | | freebsd4_sigaction() in revision 1.232.
* Push Giant down into kern_sigaction() instead of locking it around callsjhb2003-04-251-8/+6
| | | | to kern_sigaction() in the various callers of the function.
* Remove Giant from osigblock(), osigsetmask(), and kern_sigaltstack().jhb2003-04-231-15/+7
|
* - Reorganize osigstack() to do the copyin first, grab the proc lock once,jhb2003-04-231-19/+13
| | | | | | | do all the various sigstack dances, unlock the proc lock, and finally do the copyout. This more closely resembles the behavior of kern_sigaltstack() and closes a small race. - Remove Giant from osigstack as it is no longer needed.
* Unbreak sigaltstack syscall. sigonstack is now a function anddavidxu2003-04-191-7/+2
| | | | want proc lock be held.
* - Make sigonstack() a regular function instead of an inline and add a procjhb2003-04-181-5/+23
| | | | | | | | | | lock assertion to it. - SIGPENDING() no longer needs sched_lock, so only grab sched_lock to set the TDF_NEEDSIGCHK and TDF_ASTPENDING flags in signotify(). - Add a proc lock assertion to tdsigwakeup(). - Since we always set TDF_OLDMASK while holding the proc lock, the proc lock is sufficient protection to check its state in postsig() and we only need sched_lock when clearing the actual flag.
* Rename do_sigprocmask() to kern_sigprocmask() and make it a global symboljhb2003-04-181-8/+6
| | | | so that it can be used by binary emulators.
* Don't hold the proc lock while performing sigset conversions on localjhb2003-04-171-1/+1
| | | | variables.
* - Remove garbage SIGSETOR() that snuck into struct sigpending_argsjhb2003-04-171-2/+1
| | | | | | definition. - Use the proper constant for the last arg to kern_sigaction() in osigvec() instead of a magic value.
* Style fix.davidxu2003-04-121-1/+1
|
* Check SIG_HOLD action ealier to avoid missing test it in later code.davidxu2003-04-121-9/+7
|
* - p will be unused in cursig() if INVARIANTS is not defined. Access itjeff2003-04-011-3/+1
| | | | | | through td->td_proc to avoid the unused variable. Spotted by: Maxim Konovalov <maxim@macomnet.ru>
* - Define sigwait, sigtimedwait, and sigwaitinfo in terms ofjeff2003-03-311-1/+173
| | | | | | kern_sigtimedwait() which is capable of supporting all of their semantics. - These should be POSIX compliant but more careful review is needed before we announce this.
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-111/+209
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
OpenPOWER on IntegriCloud