Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_fork.c
Show First 20 Lines • Show All 943 Lines • ▼ Show 20 Lines | fork1(struct thread *td, struct fork_req *fr) | ||||
} | } | ||||
if ((flags & RFMEM) == 0) { | if ((flags & RFMEM) == 0) { | ||||
vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); | vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); | ||||
if (vm2 == NULL) { | if (vm2 == NULL) { | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto fail2; | goto fail2; | ||||
} | } | ||||
sigfastblock_afterfork(td); | |||||
if (!swap_reserve(mem_charged)) { | if (!swap_reserve(mem_charged)) { | ||||
/* | /* | ||||
* The swap reservation failed. The accounting | * The swap reservation failed. The accounting | ||||
* from the entries of the copied vm2 will be | * from the entries of the copied vm2 will be | ||||
* subtracted in vmspace_free(), so force the | * subtracted in vmspace_free(), so force the | ||||
* reservation there. | * reservation there. | ||||
*/ | */ | ||||
swap_reserve_force(mem_charged); | swap_reserve_force(mem_charged); | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | if (td->td_dbgflags & TDB_STOPATFORK) { | ||||
_STOPEVENT(p, S_SCX, td->td_sa.code); | _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); | ||||
} | } | ||||
sigfastblock_afterfork(td); | |||||
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 | ||||
} | } |