Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_trap.c
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | #ifdef VIMAGE | ||||
/* Unfortunately td_vnet_lpush needs VNET_DEBUG. */ | /* Unfortunately td_vnet_lpush needs VNET_DEBUG. */ | ||||
VNET_ASSERT(curvnet == NULL, | VNET_ASSERT(curvnet == NULL, | ||||
("%s: Returning on td %p (pid %d, %s) with vnet %p set in %s", | ("%s: Returning on td %p (pid %d, %s) with vnet %p set in %s", | ||||
__func__, td, p->p_pid, td->td_name, curvnet, | __func__, td, p->p_pid, td->td_name, curvnet, | ||||
(td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A")); | (td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A")); | ||||
#endif | #endif | ||||
} | } | ||||
void ptrace_coredump(struct proc *p); | |||||
/*static*/ | |||||
void | |||||
ptrace_coredump(struct proc *p) | |||||
{ | |||||
struct thread *td; | |||||
/* TODO: do something about the error */ | |||||
int error; | |||||
td = curthread; | |||||
if ((p->p_flag2 & P2_COREDUMP) == 0) | |||||
return; | |||||
if (p->p_sysent->sv_coredump == NULL) { | |||||
error = ENOSYS; | |||||
return; | |||||
} | |||||
if (thread_single(p, SINGLE_BOUNDARY) != 0) { | |||||
error = EBUSY; | |||||
return; | |||||
} | |||||
#if 0 | |||||
struct vnode *vp = p->p_coredump_vn; | |||||
PROC_UNLOCK(p); | |||||
error = p->p_sysent->sv_coredump(td, vp, OFF_MAX, 0); | |||||
PROC_LOCK(p); | |||||
#endif | |||||
thread_single_end(p, SINGLE_BOUNDARY); | |||||
p->p_flag2 &= ~P2_COREDUMP; | |||||
wakeup(p); | |||||
} | |||||
/* | /* | ||||
* Process an asynchronous software trap. | * Process an asynchronous software trap. | ||||
* This is relatively easy. | * This is relatively easy. | ||||
* This function will return with preemption disabled. | * This function will return with preemption disabled. | ||||
*/ | */ | ||||
void | void | ||||
ast(struct trapframe *framep) | ast(struct trapframe *framep) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | if (flags & TDF_NEEDSUSPCHK) { | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
thread_suspend_check(0); | thread_suspend_check(0); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} | } | ||||
if (td->td_pflags & TDP_OLDMASK) { | if (td->td_pflags & TDP_OLDMASK) { | ||||
td->td_pflags &= ~TDP_OLDMASK; | td->td_pflags &= ~TDP_OLDMASK; | ||||
kern_sigprocmask(td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0); | kern_sigprocmask(td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0); | ||||
} | |||||
if ((p->p_flag2 & P2_COREDUMP) != 0) { | |||||
PROC_LOCK(p); | |||||
ptrace_coredump(p); | |||||
PROC_UNLOCK(p); | |||||
} | } | ||||
#ifdef RACCT | #ifdef RACCT | ||||
if (__predict_false(racct_enable && p->p_throttled != 0)) | if (__predict_false(racct_enable && p->p_throttled != 0)) | ||||
racct_proc_throttled(p); | racct_proc_throttled(p); | ||||
#endif | #endif | ||||
userret(td, framep); | userret(td, framep); | ||||
Show All 13 Lines |