Deleted Added
full compact
kern_sig.c (209592) kern_sig.c (209688)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_sig.c 209592 2010-06-29 20:41:52Z jhb $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_sig.c 209688 2010-07-04 11:48:30Z kib $");
39
40#include "opt_compat.h"
41#include "opt_kdtrace.h"
42#include "opt_ktrace.h"
43#include "opt_core.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 2470 unchanged lines hidden (view full) ---

2517 */
2518static int
2519issignal(struct thread *td, int stop_allowed)
2520{
2521 struct proc *p;
2522 struct sigacts *ps;
2523 struct sigqueue *queue;
2524 sigset_t sigpending;
39
40#include "opt_compat.h"
41#include "opt_kdtrace.h"
42#include "opt_ktrace.h"
43#include "opt_core.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 2470 unchanged lines hidden (view full) ---

2517 */
2518static int
2519issignal(struct thread *td, int stop_allowed)
2520{
2521 struct proc *p;
2522 struct sigacts *ps;
2523 struct sigqueue *queue;
2524 sigset_t sigpending;
2525 ksiginfo_t ksi;
2526 int sig, prop, newsig;
2527
2528 p = td->td_proc;
2529 ps = p->p_sigacts;
2530 mtx_assert(&ps->ps_mtx, MA_OWNED);
2531 PROC_LOCK_ASSERT(p, MA_OWNED);
2532 for (;;) {
2533 int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG);

--- 26 unchanged lines hidden (view full) ---

2560 if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) {
2561 /*
2562 * If traced, always stop.
2563 * Remove old signal from queue before the stop.
2564 * XXX shrug off debugger, it causes siginfo to
2565 * be thrown away.
2566 */
2567 queue = &td->td_sigqueue;
2525 int sig, prop, newsig;
2526
2527 p = td->td_proc;
2528 ps = p->p_sigacts;
2529 mtx_assert(&ps->ps_mtx, MA_OWNED);
2530 PROC_LOCK_ASSERT(p, MA_OWNED);
2531 for (;;) {
2532 int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG);

--- 26 unchanged lines hidden (view full) ---

2559 if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) {
2560 /*
2561 * If traced, always stop.
2562 * Remove old signal from queue before the stop.
2563 * XXX shrug off debugger, it causes siginfo to
2564 * be thrown away.
2565 */
2566 queue = &td->td_sigqueue;
2568 ksi.ksi_signo = 0;
2569 if (sigqueue_get(queue, sig, &ksi) == 0) {
2567 td->td_dbgksi.ksi_signo = 0;
2568 if (sigqueue_get(queue, sig, &td->td_dbgksi) == 0) {
2570 queue = &p->p_sigqueue;
2569 queue = &p->p_sigqueue;
2571 sigqueue_get(queue, sig, &ksi);
2570 sigqueue_get(queue, sig, &td->td_dbgksi);
2572 }
2573
2574 mtx_unlock(&ps->ps_mtx);
2575 newsig = ptracestop(td, sig);
2576 mtx_lock(&ps->ps_mtx);
2577
2578 if (sig != newsig) {
2579

--- 10 unchanged lines hidden (view full) ---

2590 * Put the new signal into td_sigqueue. If the
2591 * signal is being masked, look for other signals.
2592 */
2593 sigqueue_add(queue, sig, NULL);
2594 if (SIGISMEMBER(td->td_sigmask, sig))
2595 continue;
2596 signotify(td);
2597 } else {
2571 }
2572
2573 mtx_unlock(&ps->ps_mtx);
2574 newsig = ptracestop(td, sig);
2575 mtx_lock(&ps->ps_mtx);
2576
2577 if (sig != newsig) {
2578

--- 10 unchanged lines hidden (view full) ---

2589 * Put the new signal into td_sigqueue. If the
2590 * signal is being masked, look for other signals.
2591 */
2592 sigqueue_add(queue, sig, NULL);
2593 if (SIGISMEMBER(td->td_sigmask, sig))
2594 continue;
2595 signotify(td);
2596 } else {
2598 if (ksi.ksi_signo != 0) {
2599 ksi.ksi_flags |= KSI_HEAD;
2597 if (td->td_dbgksi.ksi_signo != 0) {
2598 td->td_dbgksi.ksi_flags |= KSI_HEAD;
2600 if (sigqueue_add(&td->td_sigqueue, sig,
2599 if (sigqueue_add(&td->td_sigqueue, sig,
2601 &ksi) != 0)
2602 ksi.ksi_signo = 0;
2600 &td->td_dbgksi) != 0)
2601 td->td_dbgksi.ksi_signo = 0;
2603 }
2602 }
2604 if (ksi.ksi_signo == 0)
2603 if (td->td_dbgksi.ksi_signo == 0)
2605 sigqueue_add(&td->td_sigqueue, sig,
2606 NULL);
2607 }
2608
2609 /*
2610 * If the traced bit got turned off, go back up
2611 * to the top to rescan signals. This ensures
2612 * that p_sig* and p_sigact are consistent.

--- 843 unchanged lines hidden ---
2604 sigqueue_add(&td->td_sigqueue, sig,
2605 NULL);
2606 }
2607
2608 /*
2609 * If the traced bit got turned off, go back up
2610 * to the top to rescan signals. This ensures
2611 * that p_sig* and p_sigact are consistent.

--- 843 unchanged lines hidden ---