Lines Matching refs:p

157 	proc_t *p = ttoproc(t);  in restart_init()  local
158 user_t *up = PTOU(p); in restart_init()
168 zcmn_err(p->p_zone->zone_id, CE_WARN, in restart_init()
172 if (!INGLOBALZONE(p)) { in restart_init()
175 p->p_zone->zone_name, p->p_pid, reason_buf); in restart_init()
184 closeall(P_FINFO(p)); in restart_init()
191 mutex_enter(&p->p_lock); in restart_init()
192 prbarrier(p); in restart_init()
194 p->p_flag &= ~(SKILLED | SEXTKILLED | SEXITING | SDOCORE); in restart_init()
201 sigemptyset(&p->p_sig); in restart_init()
202 sigemptyset(&p->p_extsig); in restart_init()
204 sigdelq(p, t, 0); in restart_init()
205 sigdelq(p, NULL, 0); in restart_init()
207 if (p->p_killsqp) { in restart_init()
208 siginfofree(p->p_killsqp); in restart_init()
209 p->p_killsqp = NULL; in restart_init()
239 VN_HOLD(p->p_zone->zone_rootvp); in restart_init()
241 up->u_rdir = p->p_zone->zone_rootvp; in restart_init()
243 VN_HOLD(p->p_zone->zone_rootvp); in restart_init()
245 up->u_cdir = p->p_zone->zone_rootvp; in restart_init()
252 mutex_exit(&p->p_lock); in restart_init()
260 ASSERT(p == curproc); in restart_init()
268 err = exec_init(p->p_zone->zone_initname, NULL); in restart_init()
273 zcmn_err(p->p_zone->zone_id, CE_WARN, in restart_init()
276 if (!INGLOBALZONE(p)) { in restart_init()
279 p->p_zone->zone_name, p->p_pid, err); in restart_init()
314 proc_is_exiting(proc_t *p) in proc_is_exiting() argument
316 mutex_enter(&p->p_lock); in proc_is_exiting()
317 prbarrier(p); in proc_is_exiting()
318 p->p_flag |= SEXITING; in proc_is_exiting()
319 mutex_exit(&p->p_lock); in proc_is_exiting()
332 proc_t *p = ttoproc(t); in proc_exit() local
333 zone_t *z = p->p_zone; in proc_exit()
354 proc_is_exiting(p); in proc_exit()
358 mutex_enter(&p->p_lock); in proc_exit()
359 if (p->p_ttime > 0) { in proc_exit()
364 (void) task_cpu_time_incr(p->p_task, p->p_ttime); in proc_exit()
365 p->p_ttime = 0; in proc_exit()
367 mutex_exit(&p->p_lock); in proc_exit()
377 if (PROC_IS_BRANDED(p)) { in proc_exit()
379 brand_clearbrand(p, B_FALSE); in proc_exit()
389 if (p->p_pid == z->zone_proc_initpid) { in proc_exit()
421 evaporate = (p->p_flag & SSYS) || ((p->p_flag & SVFORK) && in proc_exit()
429 if (p->p_door_list) in proc_exit()
435 if (p->p_pagep) in proc_exit()
441 if (p->p_aio) in proc_exit()
447 if (p->p_lcp != NULL) in proc_exit()
453 if (p->p_dtrace_helpers != NULL) { in proc_exit()
459 if (p->p_itimer != NULL) in proc_exit()
462 if ((tmp_id = p->p_alarmid) != 0) { in proc_exit()
463 p->p_alarmid = 0; in proc_exit()
473 if (p->p_rprof_cyclic != CYCLIC_NONE) { in proc_exit()
475 cyclic_remove(p->p_rprof_cyclic); in proc_exit()
479 mutex_enter(&p->p_lock); in proc_exit()
484 if (p->p_dtrace_probes) { in proc_exit()
486 dtrace_fasttrap_exit_ptr(p); in proc_exit()
489 while ((tmp_id = p->p_itimerid) != 0) { in proc_exit()
490 p->p_itimerid = 0; in proc_exit()
491 mutex_exit(&p->p_lock); in proc_exit()
493 mutex_enter(&p->p_lock); in proc_exit()
508 prbarrier(p); in proc_exit()
510 sigfillset(&p->p_ignore); in proc_exit()
511 sigemptyset(&p->p_siginfo); in proc_exit()
512 sigemptyset(&p->p_sig); in proc_exit()
513 sigemptyset(&p->p_extsig); in proc_exit()
516 sigemptyset(&p->p_sigmask); in proc_exit()
517 sigdelq(p, t, 0); in proc_exit()
520 p->p_flag &= ~(SKILLED | SEXTKILLED); in proc_exit()
527 ASSERT(p->p_lwpcnt == 1 && p->p_zombcnt == 0); in proc_exit()
529 lwp_hash_out(p, t->t_tid); in proc_exit()
530 prexit(p); in proc_exit()
532 p->p_lwpcnt = 0; in proc_exit()
533 p->p_tlist = NULL; in proc_exit()
534 sigqfree(p); in proc_exit()
536 p->p_mterm = gethrtime(); in proc_exit()
538 exec_vp = p->p_exec; in proc_exit()
539 execdir_vp = p->p_execdir; in proc_exit()
540 p->p_exec = NULLVP; in proc_exit()
541 p->p_execdir = NULLVP; in proc_exit()
542 mutex_exit(&p->p_lock); in proc_exit()
544 pr_free_watched_pages(p); in proc_exit()
546 closeall(P_FINFO(p)); in proc_exit()
549 ASSERT(p == curproc); in proc_exit()
553 if (p->p_utraps != NULL) in proc_exit()
554 utrap_free(p); in proc_exit()
556 if (p->p_semacct) /* IPC semaphore exit */ in proc_exit()
557 semexit(p); in proc_exit()
561 exacct_commit_proc(p, rv); in proc_exit()
592 contract_exit(p); in proc_exit()
597 if ((p->p_flag & SSYS) == 0) { in proc_exit()
598 ASSERT(p->p_ct_process); in proc_exit()
599 contract_process_exit(p->p_ct_process, p, rv); in proc_exit()
605 mutex_enter(&p->p_lock); in proc_exit()
606 ASSERT(p->p_pool->pool_ref > 0); in proc_exit()
607 atomic_dec_32(&p->p_pool->pool_ref); in proc_exit()
608 p->p_pool = pool_default; in proc_exit()
615 p->p_poolflag |= PEXITED; in proc_exit()
617 mutex_exit(&p->p_lock); in proc_exit()
625 delete_ns(p->p_parent, p); in proc_exit()
631 if ((q = p->p_orphan) != NULL && p != proc_init) { in proc_exit()
633 proc_t *nokp = p->p_nextofkin; in proc_exit()
642 nokp->p_orphan = p->p_orphan; in proc_exit()
643 p->p_orphan = NULL; in proc_exit()
650 if ((q = p->p_child) != NULL && p != proc_init) { in proc_exit()
658 pgdetach(p); in proc_exit()
700 p->p_child = NULL; in proc_exit()
701 ASSERT(p->p_child_ns == NULL); in proc_exit()
704 TRACE_1(TR_FAC_PROC, TR_PROC_EXIT, "proc_exit: %p", p); in proc_exit()
706 mutex_enter(&p->p_lock); in proc_exit()
723 exacct_update_task_mstate(p); in proc_exit()
725 hrutime = mstate_aggr_state(p, LMS_USER); in proc_exit()
726 hrstime = mstate_aggr_state(p, LMS_SYSTEM); in proc_exit()
727 p->p_utime = (clock_t)NSEC_TO_TICK(hrutime) + p->p_cutime; in proc_exit()
728 p->p_stime = (clock_t)NSEC_TO_TICK(hrstime) + p->p_cstime; in proc_exit()
730 p->p_acct[LMS_USER] += p->p_cacct[LMS_USER]; in proc_exit()
731 p->p_acct[LMS_SYSTEM] += p->p_cacct[LMS_SYSTEM]; in proc_exit()
732 p->p_acct[LMS_TRAP] += p->p_cacct[LMS_TRAP]; in proc_exit()
733 p->p_acct[LMS_TFAULT] += p->p_cacct[LMS_TFAULT]; in proc_exit()
734 p->p_acct[LMS_DFAULT] += p->p_cacct[LMS_DFAULT]; in proc_exit()
735 p->p_acct[LMS_KFAULT] += p->p_cacct[LMS_KFAULT]; in proc_exit()
736 p->p_acct[LMS_USER_LOCK] += p->p_cacct[LMS_USER_LOCK]; in proc_exit()
737 p->p_acct[LMS_SLEEP] += p->p_cacct[LMS_SLEEP]; in proc_exit()
738 p->p_acct[LMS_WAIT_CPU] += p->p_cacct[LMS_WAIT_CPU]; in proc_exit()
739 p->p_acct[LMS_STOPPED] += p->p_cacct[LMS_STOPPED]; in proc_exit()
741 p->p_ru.minflt += p->p_cru.minflt; in proc_exit()
742 p->p_ru.majflt += p->p_cru.majflt; in proc_exit()
743 p->p_ru.nswap += p->p_cru.nswap; in proc_exit()
744 p->p_ru.inblock += p->p_cru.inblock; in proc_exit()
745 p->p_ru.oublock += p->p_cru.oublock; in proc_exit()
746 p->p_ru.msgsnd += p->p_cru.msgsnd; in proc_exit()
747 p->p_ru.msgrcv += p->p_cru.msgrcv; in proc_exit()
748 p->p_ru.nsignals += p->p_cru.nsignals; in proc_exit()
749 p->p_ru.nvcsw += p->p_cru.nvcsw; in proc_exit()
750 p->p_ru.nivcsw += p->p_cru.nivcsw; in proc_exit()
751 p->p_ru.sysc += p->p_cru.sysc; in proc_exit()
752 p->p_ru.ioch += p->p_cru.ioch; in proc_exit()
754 p->p_stat = SZOMB; in proc_exit()
755 p->p_proc_flag &= ~P_PR_PTRACE; in proc_exit()
756 p->p_wdata = what; in proc_exit()
757 p->p_wcode = (char)why; in proc_exit()
759 cdir = PTOU(p)->u_cdir; in proc_exit()
760 rdir = PTOU(p)->u_rdir; in proc_exit()
761 cwd = PTOU(p)->u_cwd; in proc_exit()
763 ASSERT(cdir != NULL || p->p_parent == &p0); in proc_exit()
768 rctl_set_free(p->p_rctls); in proc_exit()
779 tk = p->p_task; in proc_exit()
781 mutex_enter(&p->p_zone->zone_nlwps_lock); in proc_exit()
784 p->p_zone->zone_nlwps--; in proc_exit()
785 mutex_exit(&p->p_zone->zone_nlwps_lock); in proc_exit()
792 lwpdir = p->p_lwpdir; in proc_exit()
793 lwpdir_sz = p->p_lwpdir_sz; in proc_exit()
794 tidhash = p->p_tidhash; in proc_exit()
795 tidhash_sz = p->p_tidhash_sz; in proc_exit()
796 ret_tidhash = p->p_ret_tidhash; in proc_exit()
797 p->p_lwpdir = NULL; in proc_exit()
798 p->p_lwpfree = NULL; in proc_exit()
799 p->p_lwpdir_sz = 0; in proc_exit()
800 p->p_tidhash = NULL; in proc_exit()
801 p->p_tidhash_sz = 0; in proc_exit()
802 p->p_ret_tidhash = NULL; in proc_exit()
814 if (p->p_pctx) { in proc_exit()
816 exitpctx(p); in proc_exit()
819 freepctx(p, 0); in proc_exit()
835 if (p != t->t_procp->p_zone->zone_zsched) in proc_exit()
840 mutex_exit(&p->p_lock); in proc_exit()
842 p->p_pidflag &= ~CLDPEND; in proc_exit()
843 sigcld(p, sqp); in proc_exit()
849 cv_broadcast(&p->p_srwchan_cv); in proc_exit()
850 freeproc(p); in proc_exit()
1170 proc_detach(proc_t *p) in proc_detach() argument
1176 q = p->p_parent; in proc_detach()
1182 delete_ns(q, p); in proc_detach()
1184 if (q->p_child == p) { in proc_detach()
1185 q->p_child = p->p_sibling; in proc_detach()
1193 if (p->p_sibling) { in proc_detach()
1194 p->p_sibling->p_psibling = p->p_psibling; in proc_detach()
1197 if (p->p_psibling) { in proc_detach()
1198 p->p_psibling->p_sibling = p->p_sibling; in proc_detach()
1206 freeproc(proc_t *p) in freeproc() argument
1211 ASSERT(p->p_stat == SZOMB); in freeproc()
1212 ASSERT(p->p_tlist == NULL); in freeproc()
1215 sigdelq(p, NULL, 0); in freeproc()
1216 if (p->p_killsqp) { in freeproc()
1217 siginfofree(p->p_killsqp); in freeproc()
1218 p->p_killsqp = NULL; in freeproc()
1221 prfree(p); /* inform /proc */ in freeproc()
1227 if (p == proc_init) in freeproc()
1236 upcount_dec(crgetruid(p->p_cred), crgetzoneid(p->p_cred)); in freeproc()
1237 crfree(p->p_cred); in freeproc()
1238 if (p->p_corefile != NULL) { in freeproc()
1239 corectl_path_rele(p->p_corefile); in freeproc()
1240 p->p_corefile = NULL; in freeproc()
1242 if (p->p_content != NULL) { in freeproc()
1243 corectl_content_rele(p->p_content); in freeproc()
1244 p->p_content = NULL; in freeproc()
1247 if (p->p_nextofkin && !((p->p_nextofkin->p_flag & SNOWAIT) || in freeproc()
1248 (PTOU(p->p_nextofkin)->u_signal[SIGCLD - 1] == SIG_IGN))) { in freeproc()
1254 p->p_nextofkin->p_cutime += p->p_utime; in freeproc()
1255 p->p_nextofkin->p_cstime += p->p_stime; in freeproc()
1257 p->p_nextofkin->p_cacct[LMS_USER] += p->p_acct[LMS_USER]; in freeproc()
1258 p->p_nextofkin->p_cacct[LMS_SYSTEM] += p->p_acct[LMS_SYSTEM]; in freeproc()
1259 p->p_nextofkin->p_cacct[LMS_TRAP] += p->p_acct[LMS_TRAP]; in freeproc()
1260 p->p_nextofkin->p_cacct[LMS_TFAULT] += p->p_acct[LMS_TFAULT]; in freeproc()
1261 p->p_nextofkin->p_cacct[LMS_DFAULT] += p->p_acct[LMS_DFAULT]; in freeproc()
1262 p->p_nextofkin->p_cacct[LMS_KFAULT] += p->p_acct[LMS_KFAULT]; in freeproc()
1263 p->p_nextofkin->p_cacct[LMS_USER_LOCK] in freeproc()
1264 += p->p_acct[LMS_USER_LOCK]; in freeproc()
1265 p->p_nextofkin->p_cacct[LMS_SLEEP] += p->p_acct[LMS_SLEEP]; in freeproc()
1266 p->p_nextofkin->p_cacct[LMS_WAIT_CPU] in freeproc()
1267 += p->p_acct[LMS_WAIT_CPU]; in freeproc()
1268 p->p_nextofkin->p_cacct[LMS_STOPPED] += p->p_acct[LMS_STOPPED]; in freeproc()
1270 p->p_nextofkin->p_cru.minflt += p->p_ru.minflt; in freeproc()
1271 p->p_nextofkin->p_cru.majflt += p->p_ru.majflt; in freeproc()
1272 p->p_nextofkin->p_cru.nswap += p->p_ru.nswap; in freeproc()
1273 p->p_nextofkin->p_cru.inblock += p->p_ru.inblock; in freeproc()
1274 p->p_nextofkin->p_cru.oublock += p->p_ru.oublock; in freeproc()
1275 p->p_nextofkin->p_cru.msgsnd += p->p_ru.msgsnd; in freeproc()
1276 p->p_nextofkin->p_cru.msgrcv += p->p_ru.msgrcv; in freeproc()
1277 p->p_nextofkin->p_cru.nsignals += p->p_ru.nsignals; in freeproc()
1278 p->p_nextofkin->p_cru.nvcsw += p->p_ru.nvcsw; in freeproc()
1279 p->p_nextofkin->p_cru.nivcsw += p->p_ru.nivcsw; in freeproc()
1280 p->p_nextofkin->p_cru.sysc += p->p_ru.sysc; in freeproc()
1281 p->p_nextofkin->p_cru.ioch += p->p_ru.ioch; in freeproc()
1285 q = p->p_nextofkin; in freeproc()
1286 if (q && q->p_orphan == p) in freeproc()
1287 q->p_orphan = p->p_nextorph; in freeproc()
1290 if (q->p_nextorph == p) in freeproc()
1292 ASSERT(q && q->p_nextorph == p); in freeproc()
1293 q->p_nextorph = p->p_nextorph; in freeproc()
1300 mutex_enter(&p->p_lock); in freeproc()
1301 tk = p->p_task; in freeproc()
1302 task_detach(p); in freeproc()
1303 mutex_exit(&p->p_lock); in freeproc()
1305 proc_detach(p); in freeproc()
1306 pid_exit(p, tk); /* frees pid and proc structure */ in freeproc()