diff options
author | davidxu <davidxu@FreeBSD.org> | 2005-10-14 12:43:47 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2005-10-14 12:43:47 +0000 |
commit | 3fbdb3c21524d9d95278ada1d61b4d1e6bee654b (patch) | |
tree | 95d82b1a11b0c187223f8ac12f020b19901fa750 /sys/compat | |
parent | 6b2407fb7677ef2b8cef5c0925b3fe88a6ec7ca4 (diff) | |
download | FreeBSD-src-3fbdb3c21524d9d95278ada1d61b4d1e6bee654b.zip FreeBSD-src-3fbdb3c21524d9d95278ada1d61b4d1e6bee654b.tar.gz |
1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, most
changes in MD code are trivial, before this change, trapsignal and
sendsig use discrete parameters, now they uses member fields of
ksiginfo_t structure. For sendsig, this change allows us to pass
POSIX realtime signal value to user code.
2. Remove cpu_thread_siginfo, it is no longer needed because we now always
generate ksiginfo_t data and feed it to libpthread.
3. Add p_sigqueue to proc structure to hold shared signals which were
blocked by all threads in the proc.
4. Add td_sigqueue to thread structure to hold all signals delivered to
thread.
5. i386 and amd64 now return POSIX standard si_code, other arches will
be fixed.
6. In this sigqueue implementation, pending signal set is kept as before,
an extra siginfo list holds additional siginfo_t data for signals.
kernel code uses psignal() still behavior as before, it won't be failed
even under memory pressure, only exception is when deleting a signal,
we should call sigqueue_delete to remove signal from sigqueue but
not SIGDELSET. Current there is no kernel code will deliver a signal
with additional data, so kernel should be as stable as before,
a ksiginfo can carry more information, for example, allow signal to
be delivered but throw away siginfo data if memory is not enough.
SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can
not be caught or masked.
The sigqueue() syscall allows user code to queue a signal to target
process, if resource is unavailable, EAGAIN will be returned as
specification said.
Just before thread exits, signal queue memory will be freed by
sigqueue_flush.
Current, all signals are allowed to be queued, not only realtime signals.
Earlier patch reviewed by: jhb, deischen
Tested on: i386, amd64
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/ia32/ia32_signal.h | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 2 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_signal.h | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/sys/compat/ia32/ia32_signal.h b/sys/compat/ia32/ia32_signal.h index e79100a..267d472 100644 --- a/sys/compat/ia32/ia32_signal.h +++ b/sys/compat/ia32/ia32_signal.h @@ -199,10 +199,12 @@ struct ia32_sigframe3 { }; #endif +struct ksiginfo; extern char ia32_sigcode[]; extern char freebsd4_ia32_sigcode[]; extern int sz_ia32_sigcode; extern int sz_freebsd4_ia32_sigcode; -extern void ia32_sendsig(sig_t, int, sigset_t *, u_long); +extern void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *); extern void ia32_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); +extern void siginfo_to_ia32siginfo(siginfo_t *src, struct ia32_siginfo *dst); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index eb9115d..4b85a43 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -862,7 +862,7 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) p = td->td_proc; PROC_LOCK(p); - SIGDELSET(p->p_siglist, SIGCHLD); + sigqueue_delete(&p->p_sigqueue, SIGCHLD); PROC_UNLOCK(p); if (args->status) { diff --git a/sys/compat/svr4/svr4_signal.h b/sys/compat/svr4/svr4_signal.h index c3230fb..218236d 100644 --- a/sys/compat/svr4/svr4_signal.h +++ b/sys/compat/svr4/svr4_signal.h @@ -133,10 +133,12 @@ struct svr4_sigaltstack { #define SVR4_MINSIGSTKSZ 8192 +struct ksiginfo; + void bsd_to_svr4_sigaltstack(const struct sigaltstack *, struct svr4_sigaltstack *); void bsd_to_svr4_sigset(const sigset_t *, svr4_sigset_t *); void svr4_to_bsd_sigaltstack(const struct svr4_sigaltstack *, struct sigaltstack *); void svr4_to_bsd_sigset(const svr4_sigset_t *, sigset_t *); -void svr4_sendsig(sig_t, int, sigset_t *, u_long); +void svr4_sendsig(sig_t, struct ksiginfo *, sigset_t *); #endif /* !_SVR4_SIGNAL_H_ */ |