Lines Matching refs:p

160 	proc_t *p = ttoproc(t);  in restart_init()  local
161 proc_t *pp = p->p_zone->zone_zsched; in restart_init()
162 user_t *up = PTOU(p); in restart_init()
172 zcmn_err(p->p_zone->zone_id, CE_WARN, in restart_init()
176 if (!INGLOBALZONE(p)) { in restart_init()
179 p->p_zone->zone_name, p->p_pid, reason_buf); in restart_init()
188 closeall(P_FINFO(p)); in restart_init()
195 mutex_enter(&p->p_lock); in restart_init()
196 prbarrier(p); in restart_init()
198 p->p_flag &= ~(SKILLED | SEXTKILLED | SEXITING | SDOCORE); in restart_init()
205 sigemptyset(&p->p_sig); in restart_init()
206 sigemptyset(&p->p_extsig); in restart_init()
208 sigdelq(p, t, 0); in restart_init()
209 sigdelq(p, NULL, 0); in restart_init()
211 if (p->p_killsqp) { in restart_init()
212 siginfofree(p->p_killsqp); in restart_init()
213 p->p_killsqp = NULL; in restart_init()
243 VN_HOLD(p->p_zone->zone_rootvp); in restart_init()
245 up->u_rdir = p->p_zone->zone_rootvp; in restart_init()
247 VN_HOLD(p->p_zone->zone_rootvp); in restart_init()
249 up->u_cdir = p->p_zone->zone_rootvp; in restart_init()
258 p->p_secflags = pp->p_secflags; in restart_init()
261 mutex_exit(&p->p_lock); in restart_init()
274 mutex_enter(&p->p_crlock); in restart_init()
275 oldcr = p->p_cred; in restart_init()
277 crhold(newcr = p->p_cred = pp->p_cred); in restart_init()
279 mutex_exit(&p->p_crlock); in restart_init()
283 crset(p, newcr); in restart_init()
286 ASSERT(p == curproc); in restart_init()
294 err = exec_init(p->p_zone->zone_initname, NULL); in restart_init()
299 zcmn_err(p->p_zone->zone_id, CE_WARN, in restart_init()
302 if (!INGLOBALZONE(p)) { in restart_init()
305 p->p_zone->zone_name, p->p_pid, err); in restart_init()
340 proc_is_exiting(proc_t *p) in proc_is_exiting() argument
342 mutex_enter(&p->p_lock); in proc_is_exiting()
343 prbarrier(p); in proc_is_exiting()
344 p->p_flag |= SEXITING; in proc_is_exiting()
345 mutex_exit(&p->p_lock); in proc_is_exiting()
467 proc_t *p = ttoproc(t); in proc_exit() local
468 zone_t *z = p->p_zone; in proc_exit()
489 proc_is_exiting(p); in proc_exit()
493 mutex_enter(&p->p_lock); in proc_exit()
494 if (p->p_ttime > 0) { in proc_exit()
499 (void) task_cpu_time_incr(p->p_task, p->p_ttime); in proc_exit()
500 p->p_ttime = 0; in proc_exit()
502 mutex_exit(&p->p_lock); in proc_exit()
512 if (PROC_IS_BRANDED(p)) { in proc_exit()
514 brand_clearbrand(p, B_FALSE); in proc_exit()
524 if (p->p_pid == z->zone_proc_initpid) { in proc_exit()
541 evaporate = (p->p_flag & SSYS) || ((p->p_flag & SVFORK) && in proc_exit()
549 if (p->p_door_list) in proc_exit()
555 if (p->p_pagep) in proc_exit()
561 if (p->p_aio) in proc_exit()
567 if (p->p_lcp != NULL) in proc_exit()
573 if (p->p_dtrace_helpers != NULL) { in proc_exit()
575 (*dtrace_helpers_cleanup)(p); in proc_exit()
581 if (p->p_sigfd != NULL) { in proc_exit()
587 if (p->p_itimer != NULL) in proc_exit()
590 if ((tmp_id = p->p_alarmid) != 0) { in proc_exit()
591 p->p_alarmid = 0; in proc_exit()
598 if (p->p_upanic != NULL) { in proc_exit()
599 kmem_free(p->p_upanic, PRUPANIC_BUFLEN); in proc_exit()
600 p->p_upanic = NULL; in proc_exit()
609 if (p->p_rprof_cyclic != CYCLIC_NONE) { in proc_exit()
611 cyclic_remove(p->p_rprof_cyclic); in proc_exit()
615 mutex_enter(&p->p_lock); in proc_exit()
620 if (p->p_dtrace_probes) { in proc_exit()
622 dtrace_fasttrap_exit_ptr(p); in proc_exit()
625 while ((tmp_id = p->p_itimerid) != 0) { in proc_exit()
626 p->p_itimerid = 0; in proc_exit()
627 mutex_exit(&p->p_lock); in proc_exit()
629 mutex_enter(&p->p_lock); in proc_exit()
644 prbarrier(p); in proc_exit()
646 sigfillset(&p->p_ignore); in proc_exit()
647 sigemptyset(&p->p_siginfo); in proc_exit()
648 sigemptyset(&p->p_sig); in proc_exit()
649 sigemptyset(&p->p_extsig); in proc_exit()
652 sigemptyset(&p->p_sigmask); in proc_exit()
653 sigdelq(p, t, 0); in proc_exit()
656 p->p_flag &= ~(SKILLED | SEXTKILLED); in proc_exit()
663 ASSERT(p->p_lwpcnt == 1 && p->p_zombcnt == 0); in proc_exit()
665 lwp_hash_out(p, t->t_tid); in proc_exit()
666 prexit(p); in proc_exit()
668 p->p_lwpcnt = 0; in proc_exit()
669 p->p_tlist = NULL; in proc_exit()
670 sigqfree(p); in proc_exit()
672 p->p_mterm = gethrtime(); in proc_exit()
674 exec_vp = p->p_exec; in proc_exit()
675 execdir_vp = p->p_execdir; in proc_exit()
676 p->p_exec = NULLVP; in proc_exit()
677 p->p_execdir = NULLVP; in proc_exit()
678 mutex_exit(&p->p_lock); in proc_exit()
680 pr_free_watched_pages(p); in proc_exit()
682 closeall(P_FINFO(p)); in proc_exit()
685 ASSERT(p == curproc); in proc_exit()
689 if (p->p_utraps != NULL) in proc_exit()
690 utrap_free(p); in proc_exit()
692 if (p->p_semacct) /* IPC semaphore exit */ in proc_exit()
693 semexit(p); in proc_exit()
697 exacct_commit_proc(p, rv); in proc_exit()
728 contract_exit(p); in proc_exit()
733 if ((p->p_flag & SSYS) == 0) { in proc_exit()
734 ASSERT(p->p_ct_process); in proc_exit()
735 contract_process_exit(p->p_ct_process, p, rv); in proc_exit()
741 mutex_enter(&p->p_lock); in proc_exit()
742 ASSERT(p->p_pool->pool_ref > 0); in proc_exit()
743 atomic_dec_32(&p->p_pool->pool_ref); in proc_exit()
744 p->p_pool = pool_default; in proc_exit()
751 p->p_poolflag |= PEXITED; in proc_exit()
753 mutex_exit(&p->p_lock); in proc_exit()
761 delete_ns(p->p_parent, p); in proc_exit()
767 if ((q = p->p_orphan) != NULL && p != proc_init) { in proc_exit()
769 proc_t *nokp = p->p_nextofkin; in proc_exit()
778 nokp->p_orphan = p->p_orphan; in proc_exit()
779 p->p_orphan = NULL; in proc_exit()
786 if ((q = p->p_child) != NULL && p != proc_init) { in proc_exit()
794 pgdetach(p); in proc_exit()
836 p->p_child = NULL; in proc_exit()
837 ASSERT(p->p_child_ns == NULL); in proc_exit()
840 TRACE_1(TR_FAC_PROC, TR_PROC_EXIT, "proc_exit: %p", p); in proc_exit()
842 mutex_enter(&p->p_lock); in proc_exit()
859 exacct_update_task_mstate(p); in proc_exit()
861 hrutime = mstate_aggr_state(p, LMS_USER); in proc_exit()
862 hrstime = mstate_aggr_state(p, LMS_SYSTEM); in proc_exit()
863 p->p_utime = (clock_t)NSEC_TO_TICK(hrutime) + p->p_cutime; in proc_exit()
864 p->p_stime = (clock_t)NSEC_TO_TICK(hrstime) + p->p_cstime; in proc_exit()
866 p->p_acct[LMS_USER] += p->p_cacct[LMS_USER]; in proc_exit()
867 p->p_acct[LMS_SYSTEM] += p->p_cacct[LMS_SYSTEM]; in proc_exit()
868 p->p_acct[LMS_TRAP] += p->p_cacct[LMS_TRAP]; in proc_exit()
869 p->p_acct[LMS_TFAULT] += p->p_cacct[LMS_TFAULT]; in proc_exit()
870 p->p_acct[LMS_DFAULT] += p->p_cacct[LMS_DFAULT]; in proc_exit()
871 p->p_acct[LMS_KFAULT] += p->p_cacct[LMS_KFAULT]; in proc_exit()
872 p->p_acct[LMS_USER_LOCK] += p->p_cacct[LMS_USER_LOCK]; in proc_exit()
873 p->p_acct[LMS_SLEEP] += p->p_cacct[LMS_SLEEP]; in proc_exit()
874 p->p_acct[LMS_WAIT_CPU] += p->p_cacct[LMS_WAIT_CPU]; in proc_exit()
875 p->p_acct[LMS_STOPPED] += p->p_cacct[LMS_STOPPED]; in proc_exit()
877 p->p_ru.minflt += p->p_cru.minflt; in proc_exit()
878 p->p_ru.majflt += p->p_cru.majflt; in proc_exit()
879 p->p_ru.nswap += p->p_cru.nswap; in proc_exit()
880 p->p_ru.inblock += p->p_cru.inblock; in proc_exit()
881 p->p_ru.oublock += p->p_cru.oublock; in proc_exit()
882 p->p_ru.msgsnd += p->p_cru.msgsnd; in proc_exit()
883 p->p_ru.msgrcv += p->p_cru.msgrcv; in proc_exit()
884 p->p_ru.nsignals += p->p_cru.nsignals; in proc_exit()
885 p->p_ru.nvcsw += p->p_cru.nvcsw; in proc_exit()
886 p->p_ru.nivcsw += p->p_cru.nivcsw; in proc_exit()
887 p->p_ru.sysc += p->p_cru.sysc; in proc_exit()
888 p->p_ru.ioch += p->p_cru.ioch; in proc_exit()
890 p->p_stat = SZOMB; in proc_exit()
891 p->p_proc_flag &= ~P_PR_PTRACE; in proc_exit()
892 p->p_wdata = what; in proc_exit()
893 p->p_wcode = (char)why; in proc_exit()
895 cdir = PTOU(p)->u_cdir; in proc_exit()
896 rdir = PTOU(p)->u_rdir; in proc_exit()
897 cwd = PTOU(p)->u_cwd; in proc_exit()
899 ASSERT(cdir != NULL || p->p_parent == &p0); in proc_exit()
904 rctl_set_free(p->p_rctls); in proc_exit()
915 tk = p->p_task; in proc_exit()
917 mutex_enter(&p->p_zone->zone_nlwps_lock); in proc_exit()
920 p->p_zone->zone_nlwps--; in proc_exit()
921 mutex_exit(&p->p_zone->zone_nlwps_lock); in proc_exit()
928 lwpdir = p->p_lwpdir; in proc_exit()
929 lwpdir_sz = p->p_lwpdir_sz; in proc_exit()
930 tidhash = p->p_tidhash; in proc_exit()
931 tidhash_sz = p->p_tidhash_sz; in proc_exit()
932 ret_tidhash = p->p_ret_tidhash; in proc_exit()
933 p->p_lwpdir = NULL; in proc_exit()
934 p->p_lwpfree = NULL; in proc_exit()
935 p->p_lwpdir_sz = 0; in proc_exit()
936 p->p_tidhash = NULL; in proc_exit()
937 p->p_tidhash_sz = 0; in proc_exit()
938 p->p_ret_tidhash = NULL; in proc_exit()
950 if (p->p_pctx) { in proc_exit()
952 exitpctx(p); in proc_exit()
955 freepctx(p, 0); in proc_exit()
971 if (p != t->t_procp->p_zone->zone_zsched) in proc_exit()
976 mutex_exit(&p->p_lock); in proc_exit()
978 p->p_pidflag &= ~CLDPEND; in proc_exit()
979 sigcld(p, sqp); in proc_exit()
985 cv_broadcast(&p->p_srwchan_cv); in proc_exit()
986 freeproc(p); in proc_exit()
1306 proc_detach(proc_t *p) in proc_detach() argument
1312 q = p->p_parent; in proc_detach()
1318 delete_ns(q, p); in proc_detach()
1320 if (q->p_child == p) { in proc_detach()
1321 q->p_child = p->p_sibling; in proc_detach()
1329 if (p->p_sibling) { in proc_detach()
1330 p->p_sibling->p_psibling = p->p_psibling; in proc_detach()
1333 if (p->p_psibling) { in proc_detach()
1334 p->p_psibling->p_sibling = p->p_sibling; in proc_detach()
1342 freeproc(proc_t *p) in freeproc() argument
1347 ASSERT(p->p_stat == SZOMB); in freeproc()
1348 ASSERT(p->p_tlist == NULL); in freeproc()
1351 sigdelq(p, NULL, 0); in freeproc()
1352 if (p->p_killsqp) { in freeproc()
1353 siginfofree(p->p_killsqp); in freeproc()
1354 p->p_killsqp = NULL; in freeproc()
1357 prfree(p); /* inform /proc */ in freeproc()
1363 if (p == proc_init) in freeproc()
1372 upcount_dec(crgetruid(p->p_cred), crgetzoneid(p->p_cred)); in freeproc()
1373 crfree(p->p_cred); in freeproc()
1374 if (p->p_corefile != NULL) { in freeproc()
1375 corectl_path_rele(p->p_corefile); in freeproc()
1376 p->p_corefile = NULL; in freeproc()
1378 if (p->p_content != NULL) { in freeproc()
1379 corectl_content_rele(p->p_content); in freeproc()
1380 p->p_content = NULL; in freeproc()
1383 if (p->p_nextofkin && !((p->p_nextofkin->p_flag & SNOWAIT) || in freeproc()
1384 (PTOU(p->p_nextofkin)->u_signal[SIGCLD - 1] == SIG_IGN))) { in freeproc()
1390 p->p_nextofkin->p_cutime += p->p_utime; in freeproc()
1391 p->p_nextofkin->p_cstime += p->p_stime; in freeproc()
1393 p->p_nextofkin->p_cacct[LMS_USER] += p->p_acct[LMS_USER]; in freeproc()
1394 p->p_nextofkin->p_cacct[LMS_SYSTEM] += p->p_acct[LMS_SYSTEM]; in freeproc()
1395 p->p_nextofkin->p_cacct[LMS_TRAP] += p->p_acct[LMS_TRAP]; in freeproc()
1396 p->p_nextofkin->p_cacct[LMS_TFAULT] += p->p_acct[LMS_TFAULT]; in freeproc()
1397 p->p_nextofkin->p_cacct[LMS_DFAULT] += p->p_acct[LMS_DFAULT]; in freeproc()
1398 p->p_nextofkin->p_cacct[LMS_KFAULT] += p->p_acct[LMS_KFAULT]; in freeproc()
1399 p->p_nextofkin->p_cacct[LMS_USER_LOCK] in freeproc()
1400 += p->p_acct[LMS_USER_LOCK]; in freeproc()
1401 p->p_nextofkin->p_cacct[LMS_SLEEP] += p->p_acct[LMS_SLEEP]; in freeproc()
1402 p->p_nextofkin->p_cacct[LMS_WAIT_CPU] in freeproc()
1403 += p->p_acct[LMS_WAIT_CPU]; in freeproc()
1404 p->p_nextofkin->p_cacct[LMS_STOPPED] += p->p_acct[LMS_STOPPED]; in freeproc()
1406 p->p_nextofkin->p_cru.minflt += p->p_ru.minflt; in freeproc()
1407 p->p_nextofkin->p_cru.majflt += p->p_ru.majflt; in freeproc()
1408 p->p_nextofkin->p_cru.nswap += p->p_ru.nswap; in freeproc()
1409 p->p_nextofkin->p_cru.inblock += p->p_ru.inblock; in freeproc()
1410 p->p_nextofkin->p_cru.oublock += p->p_ru.oublock; in freeproc()
1411 p->p_nextofkin->p_cru.msgsnd += p->p_ru.msgsnd; in freeproc()
1412 p->p_nextofkin->p_cru.msgrcv += p->p_ru.msgrcv; in freeproc()
1413 p->p_nextofkin->p_cru.nsignals += p->p_ru.nsignals; in freeproc()
1414 p->p_nextofkin->p_cru.nvcsw += p->p_ru.nvcsw; in freeproc()
1415 p->p_nextofkin->p_cru.nivcsw += p->p_ru.nivcsw; in freeproc()
1416 p->p_nextofkin->p_cru.sysc += p->p_ru.sysc; in freeproc()
1417 p->p_nextofkin->p_cru.ioch += p->p_ru.ioch; in freeproc()
1421 q = p->p_nextofkin; in freeproc()
1422 if (q && q->p_orphan == p) in freeproc()
1423 q->p_orphan = p->p_nextorph; in freeproc()
1426 if (q->p_nextorph == p) in freeproc()
1428 ASSERT(q && q->p_nextorph == p); in freeproc()
1429 q->p_nextorph = p->p_nextorph; in freeproc()
1436 mutex_enter(&p->p_lock); in freeproc()
1437 tk = p->p_task; in freeproc()
1438 task_detach(p); in freeproc()
1439 mutex_exit(&p->p_lock); in freeproc()
1441 proc_detach(p); in freeproc()
1442 pid_exit(p, tk); /* frees pid and proc structure */ in freeproc()