1172
1173 if (PTOU(pp)->u_cdir) {
1174 VN_HOLD(PTOU(pp)->u_cdir);
1175 } else {
1176 ASSERT(pp == &p0);
1177 /*
1178 * We must be at or before vfs_mountroot(); it will take care of
1179 * assigning our current directory.
1180 */
1181 }
1182 if (PTOU(pp)->u_rdir)
1183 VN_HOLD(PTOU(pp)->u_rdir);
1184 if (PTOU(pp)->u_cwd)
1185 refstr_hold(PTOU(pp)->u_cwd);
1186
1187 /*
1188 * copy the parent's uarea.
1189 */
1190 uarea = PTOU(cp);
1191 bcopy(PTOU(pp), uarea, sizeof (*uarea));
1192 flist_fork(P_FINFO(pp), P_FINFO(cp));
1193
1194 gethrestime(&uarea->u_start);
1195 uarea->u_ticks = ddi_get_lbolt();
1196 uarea->u_mem = rm_asrss(pp->p_as);
1197 uarea->u_acflag = AFORK;
1198
1199 /*
1200 * If inherit-on-fork, copy /proc tracing flags to child.
1201 */
1202 if ((pp->p_proc_flag & P_PR_FORK) != 0) {
1203 cp->p_proc_flag |= pp->p_proc_flag & (P_PR_TRACE|P_PR_FORK);
1204 cp->p_sigmask = pp->p_sigmask;
1205 cp->p_fltmask = pp->p_fltmask;
1206 } else {
1207 sigemptyset(&cp->p_sigmask);
1208 premptyset(&cp->p_fltmask);
1209 uarea->u_systrap = 0;
1210 premptyset(&uarea->u_entrymask);
1211 premptyset(&uarea->u_exitmask);
1212 }
|
1172
1173 if (PTOU(pp)->u_cdir) {
1174 VN_HOLD(PTOU(pp)->u_cdir);
1175 } else {
1176 ASSERT(pp == &p0);
1177 /*
1178 * We must be at or before vfs_mountroot(); it will take care of
1179 * assigning our current directory.
1180 */
1181 }
1182 if (PTOU(pp)->u_rdir)
1183 VN_HOLD(PTOU(pp)->u_rdir);
1184 if (PTOU(pp)->u_cwd)
1185 refstr_hold(PTOU(pp)->u_cwd);
1186
1187 /*
1188 * copy the parent's uarea.
1189 */
1190 uarea = PTOU(cp);
1191 bcopy(PTOU(pp), uarea, sizeof (*uarea));
1192 flist_fork(pp, cp);
1193
1194 gethrestime(&uarea->u_start);
1195 uarea->u_ticks = ddi_get_lbolt();
1196 uarea->u_mem = rm_asrss(pp->p_as);
1197 uarea->u_acflag = AFORK;
1198
1199 /*
1200 * If inherit-on-fork, copy /proc tracing flags to child.
1201 */
1202 if ((pp->p_proc_flag & P_PR_FORK) != 0) {
1203 cp->p_proc_flag |= pp->p_proc_flag & (P_PR_TRACE|P_PR_FORK);
1204 cp->p_sigmask = pp->p_sigmask;
1205 cp->p_fltmask = pp->p_fltmask;
1206 } else {
1207 sigemptyset(&cp->p_sigmask);
1208 premptyset(&cp->p_fltmask);
1209 uarea->u_systrap = 0;
1210 premptyset(&uarea->u_entrymask);
1211 premptyset(&uarea->u_exitmask);
1212 }
|