Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_fork.c
Show First 20 Lines • Show All 579 Lines • ▼ Show 20 Lines | #endif | ||||
callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0); | callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0); | ||||
/* | /* | ||||
* If PF_FORK is set, the child process inherits the | * If PF_FORK is set, the child process inherits the | ||||
* procfs ioctl flags from its parent. | * procfs ioctl flags from its parent. | ||||
*/ | */ | ||||
if (p1->p_pfsflags & PF_FORK) { | if (p1->p_pfsflags & PF_FORK) { | ||||
p2->p_stops = p1->p_stops; | |||||
p2->p_pfsflags = p1->p_pfsflags; | p2->p_pfsflags = p1->p_pfsflags; | ||||
} | } | ||||
/* | /* | ||||
* This begins the section where we must prevent the parent | * This begins the section where we must prevent the parent | ||||
* from being swapped. | * from being swapped. | ||||
*/ | */ | ||||
_PHOLD(p1); | _PHOLD(p1); | ||||
▲ Show 20 Lines • Show All 507 Lines • ▼ Show 20 Lines | if (td->td_dbgflags & TDB_STOPATFORK) { | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} else if (p->p_flag & P_TRACED || td->td_dbgflags & TDB_BORN) { | } else if (p->p_flag & P_TRACED || td->td_dbgflags & TDB_BORN) { | ||||
/* | /* | ||||
* This is the start of a new thread in a traced | * This is the start of a new thread in a traced | ||||
* process. Report a system call exit event. | * process. Report a system call exit event. | ||||
*/ | */ | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
td->td_dbgflags |= TDB_SCX; | td->td_dbgflags |= TDB_SCX; | ||||
_STOPEVENT(p, S_SCX, td->td_sa.code); | |||||
if ((p->p_ptevents & PTRACE_SCX) != 0 || | if ((p->p_ptevents & PTRACE_SCX) != 0 || | ||||
(td->td_dbgflags & TDB_BORN) != 0) | (td->td_dbgflags & TDB_BORN) != 0) | ||||
ptracestop(td, SIGTRAP, NULL); | ptracestop(td, SIGTRAP, NULL); | ||||
td->td_dbgflags &= ~(TDB_SCX | TDB_BORN); | td->td_dbgflags &= ~(TDB_SCX | TDB_BORN); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} | } | ||||
userret(td, frame); | userret(td, frame); | ||||
#ifdef KTRACE | #ifdef KTRACE | ||||
if (KTRPOINT(td, KTR_SYSRET)) | if (KTRPOINT(td, KTR_SYSRET)) | ||||
ktrsysret(SYS_fork, 0, 0); | ktrsysret(SYS_fork, 0, 0); | ||||
#endif | #endif | ||||
} | } |