Lines Matching +full:1 +full:p1

15  * 1. Redistributions of source code must retain the above copyright
111 td->td_retval[1] = 0; in sys_fork()
137 td->td_retval[1] = 0; in sys_pdfork()
156 td->td_retval[1] = 0; in sys_vfork()
186 td->td_retval[1] = 0; in sys_rfork()
191 int __exclusive_cache_line nprocs = 1; /* process 0 */
220 else if (pid == 1) in sysctl_kern_randompid()
239 "Random PID modulus. Special values: 0: disable, 1: choose random value");
267 trypid = lastpid + 1; in fork_findpid()
279 if (result == -1) { in fork_findpid()
287 trypid = result + 1; in fork_findpid()
306 struct proc *p1; in fork_norfproc() local
311 p1 = td->td_proc; in fork_norfproc()
318 if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && in fork_norfproc()
320 PROC_LOCK(p1); in fork_norfproc()
321 if (thread_single(p1, SINGLE_BOUNDARY)) { in fork_norfproc()
322 PROC_UNLOCK(p1); in fork_norfproc()
325 PROC_UNLOCK(p1); in fork_norfproc()
343 p1->p_fd = fdtmp; in fork_norfproc()
344 p1->p_pd = pdtmp; in fork_norfproc()
356 if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && in fork_norfproc()
358 PROC_LOCK(p1); in fork_norfproc()
359 thread_single_end(p1, SINGLE_BOUNDARY); in fork_norfproc()
360 PROC_UNLOCK(p1); in fork_norfproc()
369 struct proc *p1, *pptr; in do_fork() local
375 p1 = td->td_proc; in do_fork()
377 PROC_LOCK(p1); in do_fork()
378 bcopy(&p1->p_startcopy, &p2->p_startcopy, in do_fork()
381 PROC_UNLOCK(p1); in do_fork()
392 TSFORK(p2->p_pid, p1->p_pid); in do_fork()
418 pd = pdinit(p1->p_pd, false); in do_fork()
423 pd = pdshare(p1->p_pd); in do_fork()
425 pd = pdcopy(p1->p_pd); in do_fork()
426 fd = fdcopy(p1->p_fd); in do_fork()
430 pd = pdcopy(p1->p_pd); in do_fork()
432 pd = pdshare(p1->p_pd); in do_fork()
433 fd = fdshare(p1->p_fd); in do_fork()
434 if (p1->p_fdtol == NULL) in do_fork()
435 p1->p_fdtol = filedesc_to_leader_alloc(NULL, NULL, in do_fork()
436 p1->p_leader); in do_fork()
442 fdtol = filedesc_to_leader_share(p1->p_fdtol, p1->p_fd); in do_fork()
448 fdtol = filedesc_to_leader_alloc(p1->p_fdtol, in do_fork()
449 p1->p_fd, p2); in do_fork()
459 PROC_LOCK(p1); in do_fork()
495 p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | in do_fork()
502 if (p1->p_flag & P_PROFIL) in do_fork()
506 p2->p_sigacts = sigacts_hold(p1->p_sigacts); in do_fork()
508 sigacts_copy(newsigacts, p1->p_sigacts); in do_fork()
532 p2->p_textvp = p1->p_textvp; in do_fork()
533 p2->p_textdvp = p1->p_textdvp; in do_fork()
538 if (p1->p_flag2 & P2_INHERIT_PROTECTED) { in do_fork()
546 lim_fork(p1, p2); in do_fork()
550 pstats_fork(p1->p_stats, p2->p_stats); in do_fork()
552 PROC_UNLOCK(p1); in do_fork()
563 p2->p_binname = p1->p_binname == NULL ? NULL : in do_fork()
564 strdup(p1->p_binname, M_PARGS); in do_fork()
571 p2->p_peers = p1->p_peers; in do_fork()
572 p1->p_peers = p2; in do_fork()
573 p2->p_leader = p1->p_leader; in do_fork()
575 PROC_LOCK(p1->p_leader); in do_fork()
576 if ((p1->p_leader->p_flag & P_WEXIT) != 0) { in do_fork()
577 PROC_UNLOCK(p1->p_leader); in do_fork()
579 * The task leader is exiting, so process p1 is in do_fork()
580 * going to be killed shortly. Since p1 obviously in do_fork()
584 * exit. We let p1 complete the fork, but we need in do_fork()
595 PROC_UNLOCK(p1->p_leader); in do_fork()
602 PGRP_LOCK(p1->p_pgrp); in do_fork()
604 PROC_LOCK(p1); in do_fork()
610 p2->p_flag |= p1->p_flag & P_SUGID; in do_fork()
612 SESS_LOCK(p1->p_session); in do_fork()
613 if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT) in do_fork()
615 SESS_UNLOCK(p1->p_session); in do_fork()
619 p2->p_pgrp = p1->p_pgrp; in do_fork()
620 LIST_INSERT_AFTER(p1, p2, p_pglist); in do_fork()
621 PGRP_UNLOCK(p1->p_pgrp); in do_fork()
631 _PHOLD(p1); in do_fork()
632 PROC_UNLOCK(p1); in do_fork()
642 pptr = p1->p_reaper; in do_fork()
645 p2->p_reaper = (p1->p_treeflag & P_TREE_REAPER) != 0 ? in do_fork()
646 p1 : p1->p_reaper; in do_fork()
647 pptr = p1; in do_fork()
654 if (p2->p_reaper == p1 && p1 != initproc) { in do_fork()
665 ktrprocfork(p1, p2); in do_fork()
682 } else if (p1 == &proc0) { in do_fork()
704 EVENTHANDLER_DIRECT_INVOKE(process_fork, p1, p2, fr->fr_flags); in do_fork()
710 PROC_LOCK(p1); in do_fork()
724 dtrace_fasttrap_fork(p1, p2); in do_fork()
736 knote_fork(p1->p_klist, p2->p_pid); in do_fork()
741 _PRELE(p1); in do_fork()
742 PROC_UNLOCK(p1); in do_fork()
743 SDT_PROBE3(proc, , , create, p2, p1, fr->fr_flags); in do_fork()
755 if ((p1->p_ptevents & PTRACE_FORK) != 0) { in do_fork()
760 * p1->p_ptevents & p1->p_pptr are protected by both in do_fork()
764 if ((p1->p_ptevents & PTRACE_FORK) != 0) { in do_fork()
779 proc_reparent(p2, p1->p_pptr, false); in do_fork()
850 struct proc *p1, *newproc; in fork1() local
901 p1 = td->td_proc; in fork1()
932 nprocs_new = atomic_fetchadd_int(&nprocs, 1) + 1; in fork1()
938 if (ppsratecheck(&lastfail, &curfail, 1)) { in fork1()
942 td->td_ucred->cr_ruid, p1->p_pid); in fork1()
956 pg = p1->p_pgrp; in fork1()
957 if (p1->p_numthreads > 1) { in fork1()
961 PROC_LOCK(p1); in fork1()
962 if (thread_single(p1, SINGLE_BOUNDARY)) { in fork1()
963 PROC_UNLOCK(p1); in fork1()
967 PROC_UNLOCK(p1); in fork1()
980 if (__predict_false(p1->p_pgrp != pg || sig_intr() != 0)) { in fork1()
1028 vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); in fork1()
1056 error = racct_proc_fork(p1, newproc); in fork1()
1073 if (!chgproccnt(cred->cr_ruidinfo, 1, lim_cur(td, RLIMIT_NPROC))) { in fork1()
1076 chgproccnt(cred->cr_ruidinfo, 1, 0); in fork1()
1098 atomic_add_int(&nprocs, -1); in fork1()
1103 PROC_LOCK(p1); in fork1()
1104 thread_single_end(p1, SINGLE_BOUNDARY); in fork1()
1105 PROC_UNLOCK(p1); in fork1()