2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
34 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $
35 * $DragonFly: src/sys/kern/kern_proc.c,v 1.43 2008/05/18 20:02:02 nth Exp $
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/kernel.h>
41 #include <sys/sysctl.h>
42 #include <sys/malloc.h>
45 #include <sys/filedesc.h>
47 #include <sys/signalvar.h>
48 #include <sys/spinlock.h>
52 #include <vm/vm_map.h>
54 #include <vm/vm_zone.h>
55 #include <machine/smp.h>
57 #include <sys/spinlock2.h>
59 static MALLOC_DEFINE(M_PGRP
, "pgrp", "process group header");
60 MALLOC_DEFINE(M_SESSION
, "session", "session header");
61 MALLOC_DEFINE(M_PROC
, "proc", "Proc structures");
62 MALLOC_DEFINE(M_LWP
, "lwp", "lwp structures");
63 MALLOC_DEFINE(M_SUBPROC
, "subproc", "Proc sub-structures");
65 int ps_showallprocs
= 1;
66 static int ps_showallthreads
= 1;
67 SYSCTL_INT(_security
, OID_AUTO
, ps_showallprocs
, CTLFLAG_RW
,
69 "Unprivileged processes can see proccesses with different UID/GID");
70 SYSCTL_INT(_security
, OID_AUTO
, ps_showallthreads
, CTLFLAG_RW
,
71 &ps_showallthreads
, 0,
72 "Unprivileged processes can see kernel threads");
74 static void pgdelete(struct pgrp
*);
75 static void orphanpg(struct pgrp
*pg
);
76 static pid_t
proc_getnewpid_locked(int random_offset
);
81 struct pidhashhead
*pidhashtbl
;
83 struct pgrphashhead
*pgrphashtbl
;
85 struct proclist allproc
;
86 struct proclist zombproc
;
87 struct spinlock allproc_spin
;
88 vm_zone_t thread_zone
;
91 * Random component to nextpid generation. We mix in a random factor to make
92 * it a little harder to predict. We sanity check the modulus value to avoid
93 * doing it in critical paths. Don't let it be too small or we pointlessly
94 * waste randomness entropy, and don't let it be impossibly large. Using a
95 * modulus that is too big causes a LOT more process table scans and slows
96 * down fork processing as the pidchecked caching is defeated.
98 static int randompid
= 0;
101 sysctl_kern_randompid(SYSCTL_HANDLER_ARGS
)
106 error
= sysctl_handle_int(oidp
, &pid
, 0, req
);
107 if (error
|| !req
->newptr
)
109 if (pid
< 0 || pid
> PID_MAX
- 100) /* out of range */
111 else if (pid
< 2) /* NOP */
113 else if (pid
< 100) /* Make it reasonable */
119 SYSCTL_PROC(_kern
, OID_AUTO
, randompid
, CTLTYPE_INT
|CTLFLAG_RW
,
120 0, 0, sysctl_kern_randompid
, "I", "Random PID modulus");
123 * Initialize global process hashing structures.
129 LIST_INIT(&zombproc
);
130 spin_init(&allproc_spin
);
131 pidhashtbl
= hashinit(maxproc
/ 4, M_PROC
, &pidhash
);
132 pgrphashtbl
= hashinit(maxproc
/ 4, M_PROC
, &pgrphash
);
133 thread_zone
= zinit("THREAD", sizeof (struct thread
), 0, 0, 5);
138 * Is p an inferior of the current process?
141 inferior(struct proc
*p
)
143 for (; p
!= curproc
; p
= p
->p_pptr
)
150 * Locate a process by number
157 LIST_FOREACH(p
, PIDHASH(pid
), p_hash
) {
165 * Locate a process group by number
172 LIST_FOREACH(pgrp
, PGRPHASH(pgid
), pg_hash
) {
173 if (pgrp
->pg_id
== pgid
)
180 * Move p to a new or existing process group (and session)
183 enterpgrp(struct proc
*p
, pid_t pgid
, int mksess
)
185 struct pgrp
*pgrp
= pgfind(pgid
);
187 KASSERT(pgrp
== NULL
|| !mksess
,
188 ("enterpgrp: setsid into non-empty pgrp"));
189 KASSERT(!SESS_LEADER(p
),
190 ("enterpgrp: session leader attempted setpgrp"));
193 pid_t savepid
= p
->p_pid
;
198 KASSERT(p
->p_pid
== pgid
,
199 ("enterpgrp: new pgrp and pid != pgid"));
200 if ((np
= pfind(savepid
)) == NULL
|| np
!= p
)
202 MALLOC(pgrp
, struct pgrp
*, sizeof(struct pgrp
), M_PGRP
,
205 struct session
*sess
;
210 MALLOC(sess
, struct session
*, sizeof(struct session
),
211 M_SESSION
, M_WAITOK
);
213 sess
->s_sid
= p
->p_pid
;
215 sess
->s_ttyvp
= NULL
;
217 bcopy(p
->p_session
->s_login
, sess
->s_login
,
218 sizeof(sess
->s_login
));
219 p
->p_flag
&= ~P_CONTROLT
;
220 pgrp
->pg_session
= sess
;
221 KASSERT(p
== curproc
,
222 ("enterpgrp: mksession and p != curproc"));
224 pgrp
->pg_session
= p
->p_session
;
225 sess_hold(pgrp
->pg_session
);
228 LIST_INIT(&pgrp
->pg_members
);
229 LIST_INSERT_HEAD(PGRPHASH(pgid
), pgrp
, pg_hash
);
231 SLIST_INIT(&pgrp
->pg_sigiolst
);
232 lockinit(&pgrp
->pg_lock
, "pgwt", 0, 0);
233 } else if (pgrp
== p
->p_pgrp
)
237 * Adjust eligibility of affected pgrps to participate in job control.
238 * Increment eligibility counts before decrementing, otherwise we
239 * could reach 0 spuriously during the first call.
242 fixjobc(p
, p
->p_pgrp
, 0);
244 LIST_REMOVE(p
, p_pglist
);
245 if (LIST_EMPTY(&p
->p_pgrp
->pg_members
))
248 LIST_INSERT_HEAD(&pgrp
->pg_members
, p
, p_pglist
);
253 * remove process from process group
256 leavepgrp(struct proc
*p
)
259 LIST_REMOVE(p
, p_pglist
);
260 if (LIST_EMPTY(&p
->p_pgrp
->pg_members
))
267 * delete a process group
270 pgdelete(struct pgrp
*pgrp
)
274 * Reset any sigio structures pointing to us as a result of
275 * F_SETOWN with our pgid.
277 funsetownlst(&pgrp
->pg_sigiolst
);
279 if (pgrp
->pg_session
->s_ttyp
!= NULL
&&
280 pgrp
->pg_session
->s_ttyp
->t_pgrp
== pgrp
)
281 pgrp
->pg_session
->s_ttyp
->t_pgrp
= NULL
;
282 LIST_REMOVE(pgrp
, pg_hash
);
283 sess_rele(pgrp
->pg_session
);
288 * Adjust the ref count on a session structure. When the ref count falls to
289 * zero the tty is disassociated from the session and the session structure
290 * is freed. Note that tty assocation is not itself ref-counted.
293 sess_hold(struct session
*sp
)
299 sess_rele(struct session
*sp
)
301 KKASSERT(sp
->s_count
> 0);
302 if (--sp
->s_count
== 0) {
303 if (sp
->s_ttyp
&& sp
->s_ttyp
->t_session
) {
304 #ifdef TTY_DO_FULL_CLOSE
305 /* FULL CLOSE, see ttyclearsession() */
306 KKASSERT(sp
->s_ttyp
->t_session
== sp
);
307 sp
->s_ttyp
->t_session
= NULL
;
309 /* HALF CLOSE, see ttyclearsession() */
310 if (sp
->s_ttyp
->t_session
== sp
)
311 sp
->s_ttyp
->t_session
= NULL
;
314 kfree(sp
, M_SESSION
);
319 * Adjust pgrp jobc counters when specified process changes process group.
320 * We count the number of processes in each process group that "qualify"
321 * the group for terminal job control (those with a parent in a different
322 * process group of the same session). If that count reaches zero, the
323 * process group becomes orphaned. Check both the specified process'
324 * process group and that of its children.
325 * entering == 0 => p is leaving specified group.
326 * entering == 1 => p is entering specified group.
329 fixjobc(struct proc
*p
, struct pgrp
*pgrp
, int entering
)
331 struct pgrp
*hispgrp
;
332 struct session
*mysession
= pgrp
->pg_session
;
335 * Check p's parent to see whether p qualifies its own process
336 * group; if so, adjust count for p's process group.
338 if ((hispgrp
= p
->p_pptr
->p_pgrp
) != pgrp
&&
339 hispgrp
->pg_session
== mysession
) {
342 else if (--pgrp
->pg_jobc
== 0)
347 * Check this process' children to see whether they qualify
348 * their process groups; if so, adjust counts for children's
351 LIST_FOREACH(p
, &p
->p_children
, p_sibling
)
352 if ((hispgrp
= p
->p_pgrp
) != pgrp
&&
353 hispgrp
->pg_session
== mysession
&&
354 p
->p_stat
!= SZOMB
) {
357 else if (--hispgrp
->pg_jobc
== 0)
363 * A process group has become orphaned;
364 * if there are any stopped processes in the group,
365 * hang-up all process in that group.
368 orphanpg(struct pgrp
*pg
)
372 LIST_FOREACH(p
, &pg
->pg_members
, p_pglist
) {
373 if (p
->p_stat
== SSTOP
) {
374 LIST_FOREACH(p
, &pg
->pg_members
, p_pglist
) {
384 * Add a new process to the allproc list and the PID hash. This
385 * also assigns a pid to the new process.
387 * MPALMOSTSAFE - acquires mplock for karc4random() call
390 proc_add_allproc(struct proc
*p
)
394 if ((random_offset
= randompid
) != 0) {
396 random_offset
= karc4random() % random_offset
;
400 spin_lock_wr(&allproc_spin
);
401 p
->p_pid
= proc_getnewpid_locked(random_offset
);
402 LIST_INSERT_HEAD(&allproc
, p
, p_list
);
403 LIST_INSERT_HEAD(PIDHASH(p
->p_pid
), p
, p_hash
);
404 spin_unlock_wr(&allproc_spin
);
408 * Calculate a new process pid. This function is integrated into
409 * proc_add_allproc() to guarentee that the new pid is not reused before
410 * the new process can be added to the allproc list.
412 * MPSAFE - must be called with allproc_spin held.
416 proc_getnewpid_locked(int random_offset
)
418 static pid_t nextpid
;
419 static pid_t pidchecked
;
423 * Find an unused process ID. We remember a range of unused IDs
424 * ready to use (from nextpid+1 through pidchecked-1).
426 nextpid
= nextpid
+ 1 + random_offset
;
429 * If the process ID prototype has wrapped around,
430 * restart somewhat above 0, as the low-numbered procs
431 * tend to include daemons that don't exit.
433 if (nextpid
>= PID_MAX
) {
434 nextpid
= nextpid
% PID_MAX
;
439 if (nextpid
>= pidchecked
) {
442 pidchecked
= PID_MAX
;
444 * Scan the active and zombie procs to check whether this pid
445 * is in use. Remember the lowest pid that's greater
446 * than nextpid, so we can avoid checking for a while.
448 p
= LIST_FIRST(&allproc
);
450 for (; p
!= 0; p
= LIST_NEXT(p
, p_list
)) {
451 while (p
->p_pid
== nextpid
||
452 p
->p_pgrp
->pg_id
== nextpid
||
453 p
->p_session
->s_sid
== nextpid
) {
455 if (nextpid
>= pidchecked
)
458 if (p
->p_pid
> nextpid
&& pidchecked
> p
->p_pid
)
459 pidchecked
= p
->p_pid
;
460 if (p
->p_pgrp
->pg_id
> nextpid
&&
461 pidchecked
> p
->p_pgrp
->pg_id
)
462 pidchecked
= p
->p_pgrp
->pg_id
;
463 if (p
->p_session
->s_sid
> nextpid
&&
464 pidchecked
> p
->p_session
->s_sid
)
465 pidchecked
= p
->p_session
->s_sid
;
469 p
= LIST_FIRST(&zombproc
);
477 * Called from exit1 to remove a process from the allproc
478 * list and move it to the zombie list.
483 proc_move_allproc_zombie(struct proc
*p
)
485 spin_lock_wr(&allproc_spin
);
487 spin_unlock_wr(&allproc_spin
);
488 tsleep(p
, 0, "reap1", hz
/ 10);
489 spin_lock_wr(&allproc_spin
);
491 LIST_REMOVE(p
, p_list
);
492 LIST_INSERT_HEAD(&zombproc
, p
, p_list
);
493 LIST_REMOVE(p
, p_hash
);
495 spin_unlock_wr(&allproc_spin
);
499 * This routine is called from kern_wait() and will remove the process
500 * from the zombie list and the sibling list. This routine will block
501 * if someone has a lock on the proces (p_lock).
506 proc_remove_zombie(struct proc
*p
)
508 spin_lock_wr(&allproc_spin
);
510 spin_unlock_wr(&allproc_spin
);
511 tsleep(p
, 0, "reap1", hz
/ 10);
512 spin_lock_wr(&allproc_spin
);
514 LIST_REMOVE(p
, p_list
); /* off zombproc */
515 LIST_REMOVE(p
, p_sibling
);
516 spin_unlock_wr(&allproc_spin
);
520 * Scan all processes on the allproc list. The process is automatically
521 * held for the callback. A return value of -1 terminates the loop.
526 allproc_scan(int (*callback
)(struct proc
*, void *), void *data
)
531 spin_lock_rd(&allproc_spin
);
532 LIST_FOREACH(p
, &allproc
, p_list
) {
534 spin_unlock_rd(&allproc_spin
);
535 r
= callback(p
, data
);
536 spin_lock_rd(&allproc_spin
);
541 spin_unlock_rd(&allproc_spin
);
545 * Scan all lwps of processes on the allproc list. The lwp is automatically
546 * held for the callback. A return value of -1 terminates the loop.
548 * possibly not MPSAFE, needs to access foreingn proc structures
551 alllwp_scan(int (*callback
)(struct lwp
*, void *), void *data
)
557 spin_lock_rd(&allproc_spin
);
558 LIST_FOREACH(p
, &allproc
, p_list
) {
560 spin_unlock_rd(&allproc_spin
);
561 FOREACH_LWP_IN_PROC(lp
, p
) {
563 r
= callback(lp
, data
);
566 spin_lock_rd(&allproc_spin
);
571 spin_unlock_rd(&allproc_spin
);
575 * Scan all processes on the zombproc list. The process is automatically
576 * held for the callback. A return value of -1 terminates the loop.
581 zombproc_scan(int (*callback
)(struct proc
*, void *), void *data
)
586 spin_lock_rd(&allproc_spin
);
587 LIST_FOREACH(p
, &zombproc
, p_list
) {
589 spin_unlock_rd(&allproc_spin
);
590 r
= callback(p
, data
);
591 spin_lock_rd(&allproc_spin
);
596 spin_unlock_rd(&allproc_spin
);
603 DB_SHOW_COMMAND(pgrpdump
, pgrpdump
)
609 for (i
= 0; i
<= pgrphash
; i
++) {
610 if (!LIST_EMPTY(&pgrphashtbl
[i
])) {
611 kprintf("\tindx %d\n", i
);
612 LIST_FOREACH(pgrp
, &pgrphashtbl
[i
], pg_hash
) {
614 "\tpgrp %p, pgid %ld, sess %p, sesscnt %d, mem %p\n",
615 (void *)pgrp
, (long)pgrp
->pg_id
,
616 (void *)pgrp
->pg_session
,
617 pgrp
->pg_session
->s_count
,
618 (void *)LIST_FIRST(&pgrp
->pg_members
));
619 LIST_FOREACH(p
, &pgrp
->pg_members
, p_pglist
) {
620 kprintf("\t\tpid %ld addr %p pgrp %p\n",
621 (long)p
->p_pid
, (void *)p
,
631 * Locate a process on the zombie list. Return a held process or NULL.
638 LIST_FOREACH(p
, &zombproc
, p_list
)
645 sysctl_out_proc(struct proc
*p
, struct sysctl_req
*req
, int flags
)
647 struct kinfo_proc ki
;
649 int skp
= 0, had_output
= 0;
652 fill_kinfo_proc(p
, &ki
);
653 if ((flags
& KERN_PROC_FLAG_LWP
) == 0)
655 FOREACH_LWP_IN_PROC(lp
, p
) {
656 fill_kinfo_lwp(lp
, &ki
.kp_lwp
);
659 error
= SYSCTL_OUT(req
, &ki
, sizeof(ki
));
665 /* We need to output at least the proc, even if there is no lwp. */
669 if (!doingzomb
&& pid
&& (pfind(pid
) != p
))
671 if (doingzomb
&& zpfind(pid
) != p
)
678 sysctl_out_proc_kthread(struct thread
*td
, struct sysctl_req
*req
, int flags
)
680 struct kinfo_proc ki
;
683 fill_kinfo_proc_kthread(td
, &ki
);
684 error
= SYSCTL_OUT(req
, &ki
, sizeof(ki
));
691 sysctl_kern_proc(SYSCTL_HANDLER_ARGS
)
693 int *name
= (int*) arg1
;
694 int oid
= oidp
->oid_number
;
695 u_int namelen
= arg2
;
697 struct proclist
*plist
;
699 int doingzomb
, flags
= 0;
703 struct ucred
*cr1
= curproc
->p_ucred
;
705 flags
= oid
& KERN_PROC_FLAGMASK
;
706 oid
&= ~KERN_PROC_FLAGMASK
;
708 if ((oid
== KERN_PROC_ALL
&& namelen
!= 0) ||
709 (oid
!= KERN_PROC_ALL
&& namelen
!= 1))
712 if (oid
== KERN_PROC_PID
) {
713 p
= pfind((pid_t
)name
[0]);
716 if (!PRISON_CHECK(cr1
, p
->p_ucred
))
719 error
= sysctl_out_proc(p
, req
, flags
);
725 /* overestimate by 5 procs */
726 error
= SYSCTL_OUT(req
, 0, sizeof (struct kinfo_proc
) * 5);
730 for (doingzomb
= 0; doingzomb
<= 1; doingzomb
++) {
735 LIST_FOREACH_MUTABLE(p
, plist
, p_list
, np
) {
737 * Show a user only their processes.
739 if ((!ps_showallprocs
) && p_trespass(cr1
, p
->p_ucred
))
742 * Skip embryonic processes.
744 if (p
->p_stat
== SIDL
)
747 * TODO - make more efficient (see notes below).
752 /* could do this by traversing pgrp */
753 if (p
->p_pgrp
== NULL
||
754 p
->p_pgrp
->pg_id
!= (pid_t
)name
[0])
759 if ((p
->p_flag
& P_CONTROLT
) == 0 ||
760 p
->p_session
== NULL
||
761 p
->p_session
->s_ttyp
== NULL
||
762 dev2udev(p
->p_session
->s_ttyp
->t_dev
) !=
768 if (p
->p_ucred
== NULL
||
769 p
->p_ucred
->cr_uid
!= (uid_t
)name
[0])
774 if (p
->p_ucred
== NULL
||
775 p
->p_ucred
->cr_ruid
!= (uid_t
)name
[0])
780 if (!PRISON_CHECK(cr1
, p
->p_ucred
))
783 error
= sysctl_out_proc(p
, req
, flags
);
791 * Iterate over all active cpus and scan their thread list. Start
792 * with the next logical cpu and end with our original cpu. We
793 * migrate our own thread to each target cpu in order to safely scan
794 * its thread list. In the last loop we migrate back to our original
797 origcpu
= mycpu
->gd_cpuid
;
798 if (!ps_showallthreads
|| jailed(cr1
))
800 for (n
= 1; n
<= ncpus
; ++n
) {
804 nid
= (origcpu
+ n
) % ncpus
;
805 if ((smp_active_mask
& (1 << nid
)) == 0)
807 rgd
= globaldata_find(nid
);
808 lwkt_setcpu_self(rgd
);
810 TAILQ_FOREACH(td
, &mycpu
->gd_tdallq
, td_allq
) {
823 error
= sysctl_out_proc_kthread(td
, req
, doingzomb
);
834 * This sysctl allows a process to retrieve the argument list or process
835 * title for another process without groping around in the address space
836 * of the other process. It also allow a process to set its own "process
837 * title to a string of its own choice.
840 sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS
)
842 int *name
= (int*) arg1
;
843 u_int namelen
= arg2
;
847 struct ucred
*cr1
= curproc
->p_ucred
;
852 p
= pfind((pid_t
)name
[0]);
856 if ((!ps_argsopen
) && p_trespass(cr1
, p
->p_ucred
))
859 if (req
->newptr
&& curproc
!= p
)
862 if (req
->oldptr
&& p
->p_args
!= NULL
)
863 error
= SYSCTL_OUT(req
, p
->p_args
->ar_args
, p
->p_args
->ar_length
);
864 if (req
->newptr
== NULL
)
867 if (p
->p_args
&& --p
->p_args
->ar_ref
== 0)
868 FREE(p
->p_args
, M_PARGS
);
871 if (req
->newlen
+ sizeof(struct pargs
) > ps_arg_cache_limit
)
874 MALLOC(pa
, struct pargs
*, sizeof(struct pargs
) + req
->newlen
,
877 pa
->ar_length
= req
->newlen
;
878 error
= SYSCTL_IN(req
, pa
->ar_args
, req
->newlen
);
886 SYSCTL_NODE(_kern
, KERN_PROC
, proc
, CTLFLAG_RD
, 0, "Process table");
888 SYSCTL_PROC(_kern_proc
, KERN_PROC_ALL
, all
, CTLFLAG_RD
|CTLTYPE_STRUCT
,
889 0, 0, sysctl_kern_proc
, "S,proc", "Return entire process table");
891 SYSCTL_NODE(_kern_proc
, KERN_PROC_PGRP
, pgrp
, CTLFLAG_RD
,
892 sysctl_kern_proc
, "Process table");
894 SYSCTL_NODE(_kern_proc
, KERN_PROC_TTY
, tty
, CTLFLAG_RD
,
895 sysctl_kern_proc
, "Process table");
897 SYSCTL_NODE(_kern_proc
, KERN_PROC_UID
, uid
, CTLFLAG_RD
,
898 sysctl_kern_proc
, "Process table");
900 SYSCTL_NODE(_kern_proc
, KERN_PROC_RUID
, ruid
, CTLFLAG_RD
,
901 sysctl_kern_proc
, "Process table");
903 SYSCTL_NODE(_kern_proc
, KERN_PROC_PID
, pid
, CTLFLAG_RD
,
904 sysctl_kern_proc
, "Process table");
906 SYSCTL_NODE(_kern_proc
, (KERN_PROC_ALL
| KERN_PROC_FLAG_LWP
), all_lwp
, CTLFLAG_RD
,
907 sysctl_kern_proc
, "Process table");
909 SYSCTL_NODE(_kern_proc
, (KERN_PROC_PGRP
| KERN_PROC_FLAG_LWP
), pgrp_lwp
, CTLFLAG_RD
,
910 sysctl_kern_proc
, "Process table");
912 SYSCTL_NODE(_kern_proc
, (KERN_PROC_TTY
| KERN_PROC_FLAG_LWP
), tty_lwp
, CTLFLAG_RD
,
913 sysctl_kern_proc
, "Process table");
915 SYSCTL_NODE(_kern_proc
, (KERN_PROC_UID
| KERN_PROC_FLAG_LWP
), uid_lwp
, CTLFLAG_RD
,
916 sysctl_kern_proc
, "Process table");
918 SYSCTL_NODE(_kern_proc
, (KERN_PROC_RUID
| KERN_PROC_FLAG_LWP
), ruid_lwp
, CTLFLAG_RD
,
919 sysctl_kern_proc
, "Process table");
921 SYSCTL_NODE(_kern_proc
, (KERN_PROC_PID
| KERN_PROC_FLAG_LWP
), pid_lwp
, CTLFLAG_RD
,
922 sysctl_kern_proc
, "Process table");
924 SYSCTL_NODE(_kern_proc
, KERN_PROC_ARGS
, args
, CTLFLAG_RW
| CTLFLAG_ANYBODY
,
925 sysctl_kern_proc_args
, "Process argument list");