summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sig.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* - Mark signals which may be delivered to any thread in the process withjeff2003-03-311-31/+32
| | | | | SA_PROC. Signals without this flag should be directed to a particular thread if this is possible.
* - Change trapsignal() to accept a thread and not a proc.jeff2003-03-311-6/+6
| | | | | | | - Change all consumers to pass in a thread. Right now this does not cause any functional changes but it will be important later when signals can be delivered to specific threads.
* Fix threaded process job control bug. SMP tested.davidxu2003-03-111-27/+33
| | | | Reviewed by: julian
* Hold the proc lock while accessing p_procsig in trapsignal().tjr2003-03-091-1/+2
|
* Replace calls to WITNESS_SLEEP() and witness_list() with equivalent callsjhb2003-03-041-1/+2
| | | | to WITNESS_WARN().
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-1/+1
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* Fix a bug when handling SIGCONT.davidxu2003-02-261-7/+0
| | | | Reported By: Mike Makonnen <mtm@identd.net>
* - Add a new function, thread_signal_add(), that is called from postsig tojeff2003-02-171-3/+4
| | | | | | | | add a signal to a mailbox's pending set. - Add a new function, thread_signal_upcall(), this causes the current thread to upcall so that we can deliver pending signals. Reviewed by: mini
* Move a bunch of flags from the KSE to the thread.julian2003-02-171-3/+3
| | | | | | | | I was in two minds as to where to put them in the first case.. I should have listenned to the other mind. Submitted by: parts by davidxu@ Reviewed by: jeff@ mini@
* - Split the struct kse into struct upcall and struct kse. struct kse willjeff2003-02-171-6/+0
| | | | | | | soon be visible only to schedulers. This greatly simplifies much the KSE code. Submitted by: davidxu
* Acquire Giant around calls to kern_sigaction() in sigaction(),tjr2003-02-151-17/+9
| | | | | | | freebsd4_sigaction() and osigaction() instead of around the whole body of those functions. They now no longer hold Giant around calls to copyin() and copyout(), and it is slightly more obvious what Giant is protecting.
* osigpending() no longer needs Giant, for the same reason sigpending()tjr2003-02-151-3/+0
| | | | does not.
* All uses of p_siglist are protected by the proc lock now, so there'stjr2003-02-151-6/+1
| | | | no need to acquire Giant in sigpending() anymore.
* Reversion of commit by Davidxu plus fixes since applied.julian2003-02-011-0/+6
| | | | | | | | I'm not convinced there is anything major wrong with the patch but them's the rules.. I am using my "David's mentor" hat to revert this as he's offline for a while.
* No longer force COMPAT_FREEBSD4 to be on.peter2003-01-271-3/+0
|
* Move UPCALL related data structure out of kse, introduce a newdavidxu2003-01-261-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data structure called kse_upcall to manage UPCALL. All KSE binding and loaning code are gone. A thread owns an upcall can collect all completed syscall contexts in its ksegrp, turn itself into UPCALL mode, and takes those contexts back to userland. Any thread without upcall structure has to export their contexts and exit at user boundary. Any thread running in user mode owns an upcall structure, when it enters kernel, if the kse mailbox's current thread pointer is not NULL, then when the thread is blocked in kernel, a new UPCALL thread is created and the upcall structure is transfered to the new UPCALL thread. if the kse mailbox's current thread pointer is NULL, then when a thread is blocked in kernel, no UPCALL thread will be created. Each upcall always has an owner thread. Userland can remove an upcall by calling kse_exit, when all upcalls in ksegrp are removed, the group is atomatically shutdown. An upcall owner thread also exits when process is in exiting state. when an owner thread exits, the upcall it owns is also removed. KSE is a pure scheduler entity. it represents a virtual cpu. when a thread is running, it always has a KSE associated with it. scheduler is free to assign a KSE to thread according thread priority, if thread priority is changed, KSE can be moved from one thread to another. When a ksegrp is created, there is always N KSEs created in the group. the N is the number of physical cpu in the current system. This makes it is possible that even an userland UTS is single CPU safe, threads in kernel still can execute on different cpu in parallel. Userland calls kse_create to add more upcall structures into ksegrp to increase concurrent in userland itself, kernel is not restricted by number of upcalls userland provides. The code hasn't been tested under SMP by author due to lack of hardware. Reviewed by: julian
* Forgot to call setrunnable() for un-idled thread.davidxu2003-01-071-0/+1
|
* Check signals for idled threads.davidxu2003-01-071-2/+2
|
OpenPOWER on IntegriCloud