Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_sig.c
Show First 20 Lines • Show All 2,515 Lines • ▼ Show 20 Lines | if (TD_IS_RUNNING(td) && td != curthread) | ||||
forward_signal(td); | forward_signal(td); | ||||
#endif | #endif | ||||
out: | out: | ||||
PROC_SUNLOCK(p); | PROC_SUNLOCK(p); | ||||
thread_unlock(td); | thread_unlock(td); | ||||
} | } | ||||
static void | |||||
ptrace_coredump(struct thread *td) | |||||
{ | |||||
struct proc *p; | |||||
struct thr_coredump_req *tcq; | |||||
void *rl_cookie; | |||||
MPASS(td == curthread); | |||||
p = td->td_proc; | |||||
PROC_LOCK_ASSERT(p, MA_OWNED); | |||||
if ((td->td_dbgflags & TDB_COREDUMPRQ) == 0) | |||||
return; | |||||
KASSERT((p->p_flag & P_STOPPED_TRACE) != 0, ("not stopped")); | |||||
tcq = td->td_coredump; | |||||
KASSERT(tcq != NULL, ("td_coredump is NULL")); | |||||
if (p->p_sysent->sv_coredump == NULL) { | |||||
tcq->tc_error = ENOSYS; | |||||
goto wake; | |||||
} | |||||
PROC_UNLOCK(p); | |||||
rl_cookie = vn_rangelock_wlock(tcq->tc_vp, 0, OFF_MAX); | |||||
tcq->tc_error = p->p_sysent->sv_coredump(td, tcq->tc_vp, | |||||
tcq->tc_limit, tcq->tc_flags); | |||||
markj: Should it be `tc_flags`? | |||||
vn_rangelock_unlock(tcq->tc_vp, rl_cookie); | |||||
PROC_LOCK(p); | |||||
wake: | |||||
td->td_dbgflags &= ~TDB_COREDUMPRQ; | |||||
td->td_coredump = NULL; | |||||
wakeup(p); | |||||
} | |||||
static int | static int | ||||
sig_suspend_threads(struct thread *td, struct proc *p, int sending) | sig_suspend_threads(struct thread *td, struct proc *p, int sending) | ||||
{ | { | ||||
struct thread *td2; | struct thread *td2; | ||||
int wakeup_swapper; | int wakeup_swapper; | ||||
PROC_LOCK_ASSERT(p, MA_OWNED); | PROC_LOCK_ASSERT(p, MA_OWNED); | ||||
PROC_SLOCK_ASSERT(p, MA_OWNED); | PROC_SLOCK_ASSERT(p, MA_OWNED); | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | while ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_XSIG)) { | ||||
p->p_flag2 &= ~P2_PTRACE_FSTP; | p->p_flag2 &= ~P2_PTRACE_FSTP; | ||||
p->p_flag |= P_STOPPED_SIG | P_STOPPED_TRACE; | p->p_flag |= P_STOPPED_SIG | P_STOPPED_TRACE; | ||||
sig_suspend_threads(td, p, 0); | sig_suspend_threads(td, p, 0); | ||||
} | } | ||||
if ((td->td_dbgflags & TDB_STOPATFORK) != 0) { | if ((td->td_dbgflags & TDB_STOPATFORK) != 0) { | ||||
td->td_dbgflags &= ~TDB_STOPATFORK; | td->td_dbgflags &= ~TDB_STOPATFORK; | ||||
} | } | ||||
stopme: | stopme: | ||||
td->td_dbgflags |= TDB_SSWITCH; | |||||
thread_suspend_switch(td, p); | thread_suspend_switch(td, p); | ||||
td->td_dbgflags &= ~TDB_SSWITCH; | |||||
if ((td->td_dbgflags & TDB_COREDUMPRQ) != 0) { | |||||
PROC_SUNLOCK(p); | |||||
ptrace_coredump(td); | |||||
PROC_SLOCK(p); | |||||
goto stopme; | |||||
} | |||||
if (p->p_xthread == td) | if (p->p_xthread == td) | ||||
p->p_xthread = NULL; | p->p_xthread = NULL; | ||||
if (!(p->p_flag & P_TRACED)) | if (!(p->p_flag & P_TRACED)) | ||||
break; | break; | ||||
if (td->td_dbgflags & TDB_SUSPEND) { | if (td->td_dbgflags & TDB_SUSPEND) { | ||||
if (p->p_flag & P_SINGLE_EXIT) | if (p->p_flag & P_SINGLE_EXIT) | ||||
break; | break; | ||||
goto stopme; | goto stopme; | ||||
▲ Show 20 Lines • Show All 1,603 Lines • Show Last 20 Lines |
Should it be tc_flags?