FreeBSD kernel kern code
kern_proc.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_ktrace.h"
#include "opt_kstack_pages.h"
#include "opt_stack.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bitstring.h>
#include <sys/elf.h>
#include <sys/eventhandler.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/loginclass.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/refcount.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sbuf.h>
#include <sys/sysent.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/stack.h>
#include <sys/stat.h>
#include <sys/dtrace_bsd.h>
#include <sys/sysctl.h>
#include <sys/filedesc.h>
#include <sys/tty.h>
#include <sys/signalvar.h>
#include <sys/sdt.h>
#include <sys/sx.h>
#include <sys/user.h>
#include <sys/vnode.h>
#include <sys/wait.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/uma.h>
#include <fs/devfs/devfs.h>

Go to the source code of this file.

Data Structures

struct  kern_proc_out_args
 

Macros

#define PROC_AUXV_MAX   256 /* Safety limit on auxv size. */
 
#define GET_PS_STRINGS_CHUNK_SZ   256 /* Chunk size (bytes) for ps_strings operations. */
 

Enumerations

enum  proc_vector_type { PROC_ARG , PROC_ENV , PROC_AUX }
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SDT_PROVIDER_DEFINE (proc)
 
 MALLOC_DEFINE (M_SESSION, "session", "session header")
 
static MALLOC_DEFINE (M_PROC, "proc", "Proc structures")
 
 MALLOC_DEFINE (M_SUBPROC, "subproc", "Proc sub-structures")
 
static void doenterpgrp (struct proc *, struct pgrp *)
 
static void orphanpg (struct pgrp *pg)
 
static void fill_kinfo_aggregate (struct proc *p, struct kinfo_proc *kp)
 
static void fill_kinfo_proc_only (struct proc *p, struct kinfo_proc *kp)
 
static void fill_kinfo_thread (struct thread *td, struct kinfo_proc *kp, int preferthread)
 
static void pgdelete (struct pgrp *)
 
static int pgrp_init (void *mem, int size, int flags)
 
static int proc_ctor (void *mem, int size, void *arg, int flags)
 
static void proc_dtor (void *mem, int size, void *arg)
 
static int proc_init (void *mem, int size, int flags)
 
static void proc_fini (void *mem, int size)
 
static void pargs_free (struct pargs *pa)
 
 EVENTHANDLER_LIST_DEFINE (process_ctor)
 
 EVENTHANDLER_LIST_DEFINE (process_dtor)
 
 EVENTHANDLER_LIST_DEFINE (process_init)
 
 EVENTHANDLER_LIST_DEFINE (process_fini)
 
 EVENTHANDLER_LIST_DEFINE (process_exit)
 
 EVENTHANDLER_LIST_DEFINE (process_fork)
 
 EVENTHANDLER_LIST_DEFINE (process_exec)
 
 SYSCTL_INT (_kern, OID_AUTO, kstack_pages, CTLFLAG_RD, &kstack_pages, 0, "Kernel stack size in pages")
 
 SYSCTL_INT (_kern, OID_AUTO, proc_vmmap_skip_resident_count, CTLFLAG_RW, &vmmap_skip_res_cnt, 0, "Skip calculation of the pages resident count in kern.proc.vmmap")
 
 CTASSERT (sizeof(struct kinfo_proc)==KINFO_PROC_SIZE)
 
void procinit (void)
 
bitstr_t bit_decl (proc_id_pidmap, PID_MAX)
 
bitstr_t bit_decl (proc_id_grpidmap, PID_MAX)
 
bitstr_t bit_decl (proc_id_sessidmap, PID_MAX)
 
bitstr_t bit_decl (proc_id_reapmap, PID_MAX)
 
void proc_id_set (int type, pid_t id)
 
void proc_id_set_cond (int type, pid_t id)
 
void proc_id_clear (int type, pid_t id)
 
int inferior (struct proc *p)
 
void pidhash_slockall (void)
 
void pidhash_sunlockall (void)
 
struct proc * pfind_any_locked (pid_t pid)
 
static __always_inline struct proc * _pfind (pid_t pid, bool zombie)
 
struct proc * pfind (pid_t pid)
 
struct proc * pfind_any (pid_t pid)
 
struct pgrp * pgfind (pid_t pgid)
 
int pget (pid_t pid, int flags, struct proc **pp)
 
int enterpgrp (struct proc *p, pid_t pgid, struct pgrp *pgrp, struct session *sess)
 
int enterthispgrp (struct proc *p, struct pgrp *pgrp)
 
static bool isjobproc (struct proc *q, struct pgrp *pgrp)
 
static struct proc * jobc_reaper (struct proc *p)
 
static struct proc * jobc_parent (struct proc *p, struct proc *p_exiting)
 
static int pgrp_calc_jobc (struct pgrp *pgrp)
 
int leavepgrp (struct proc *p)
 
static void fixjobc_kill (struct proc *p)
 
void killjobc (void)
 
void sess_hold (struct session *s)
 
void sess_release (struct session *s)
 
static void fill_kinfo_proc_pgrp (struct proc *p, struct kinfo_proc *kp)
 
void fill_kinfo_proc (struct proc *p, struct kinfo_proc *kp)
 
struct pstats * pstats_alloc (void)
 
void pstats_fork (struct pstats *src, struct pstats *dst)
 
void pstats_free (struct pstats *ps)
 
static ssize_t kern_proc_out_size (struct proc *p, int flags)
 
int kern_proc_out (struct proc *p, struct sbuf *sb, int flags)
 
static int sysctl_out_proc (struct proc *p, struct sysctl_req *req, int flags)
 
int proc_iterate (int(*cb)(struct proc *, void *), void *cbarg)
 
static int sysctl_kern_proc_iterate (struct proc *p, void *origarg)
 
static int sysctl_kern_proc (SYSCTL_HANDLER_ARGS)
 
struct pargs * pargs_alloc (int len)
 
void pargs_hold (struct pargs *pa)
 
void pargs_drop (struct pargs *pa)
 
static int proc_read_string (struct thread *td, struct proc *p, const char *sptr, char *buf, size_t len)
 
static int get_proc_vector (struct thread *td, struct proc *p, char ***proc_vectorp, size_t *vsizep, enum proc_vector_type type)
 
static int get_ps_strings (struct thread *td, struct proc *p, struct sbuf *sb, enum proc_vector_type type)
 
int proc_getargv (struct thread *td, struct proc *p, struct sbuf *sb)
 
int proc_getenvv (struct thread *td, struct proc *p, struct sbuf *sb)
 
int proc_getauxv (struct thread *td, struct proc *p, struct sbuf *sb)
 
static int sysctl_kern_proc_args (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_env (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_auxv (SYSCTL_HANDLER_ARGS)
 
int proc_get_binpath (struct proc *p, char *binname, char **retbuf, char **freebuf)
 
static int sysctl_kern_proc_pathname (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_sv_name (SYSCTL_HANDLER_ARGS)
 
void kern_proc_vmmap_resident (vm_map_t map, vm_map_entry_t entry, int *resident_count, bool *super)
 
int kern_proc_vmmap_out (struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
 
static int sysctl_kern_proc_vmmap (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_groups (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_rlimit (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_ps_strings (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_umask (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_osrel (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_sigtramp (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_sigfastblk (SYSCTL_HANDLER_ARGS)
 
static int sysctl_kern_proc_vm_layout (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_NODE (_kern, KERN_PROC, proc, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "Process table")
 
 SYSCTL_PROC (_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_proc, "S,proc", "Return entire process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_GID, gid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_PGRP, pgrp, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_RGID, rgid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_SESSION, sid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_RUID, ruid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_PID, pid, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_PROC, proc, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Return process table, no threads")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_ARGS, args, CTLFLAG_RW|CTLFLAG_CAPWR|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, sysctl_kern_proc_args, "Process argument list")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_ENV, env, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_env, "Process environment")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_AUXV, auxv, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_auxv, "Process ELF auxiliary vector")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_PATHNAME, pathname, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_pathname, "Process executable path")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_SV_NAME, sv_name, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_sv_name, "Process syscall vector name (ABI type)")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_GID|KERN_PROC_INC_THREAD), gid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_PGRP|KERN_PROC_INC_THREAD), pgrp_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_RGID|KERN_PROC_INC_THREAD), rgid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_SESSION|KERN_PROC_INC_THREAD), sid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_TTY|KERN_PROC_INC_THREAD), tty_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_UID|KERN_PROC_INC_THREAD), uid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_RUID|KERN_PROC_INC_THREAD), ruid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_PID|KERN_PROC_INC_THREAD), pid_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table")
 
static SYSCTL_NODE (_kern_proc,(KERN_PROC_PROC|KERN_PROC_INC_THREAD), proc_td, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc, "Return process table, including threads")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_VMMAP, vmmap, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_vmmap, "Process vm map entries")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_GROUPS, groups, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_groups, "Process groups")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_RLIMIT, rlimit, CTLFLAG_RW|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, sysctl_kern_proc_rlimit, "Process resource limits")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_PS_STRINGS, ps_strings, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_ps_strings, "Process ps_strings location")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_umask, "Process umask")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_OSREL, osrel, CTLFLAG_RW|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, sysctl_kern_proc_osrel, "Process binary osreldate")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_SIGTRAMP, sigtramp, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_sigtramp, "Process signal trampoline location")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_SIGFASTBLK, sigfastblk, CTLFLAG_RD|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, sysctl_kern_proc_sigfastblk, "Thread sigfastblock address")
 
static SYSCTL_NODE (_kern_proc, KERN_PROC_VM_LAYOUT, vm_layout, CTLFLAG_RD|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, sysctl_kern_proc_vm_layout, "Process virtual address space layout info")
 
void stop_all_proc (void)
 
void resume_all_proc (void)
 

Variables

struct pidhashhead * pidhashtbl = NULL
 
struct sx * pidhashtbl_lock
 
u_long pidhash
 
u_long pidhashlock
 
struct pgrphashhead * pgrphashtbl
 
u_long pgrphash
 
struct proclist allproc = LIST_HEAD_INITIALIZER(allproc)
 
struct sx __exclusive_cache_line allproc_lock
 
struct sx __exclusive_cache_line proctree_lock
 
struct mtx __exclusive_cache_line ppeers_lock
 
struct mtx __exclusive_cache_line procid_lock
 
uma_zone_t proc_zone
 
uma_zone_t pgrp_zone
 
const int proc_off_p_pid = offsetof(struct proc, p_pid)
 
const int proc_off_p_comm = offsetof(struct proc, p_comm)
 
const int proc_off_p_list = offsetof(struct proc, p_list)
 
const int proc_off_p_hash = offsetof(struct proc, p_hash)
 
const int proc_off_p_threads = offsetof(struct proc, p_threads)
 
const int thread_off_td_tid = offsetof(struct thread, td_tid)
 
const int thread_off_td_name = offsetof(struct thread, td_name)
 
const int thread_off_td_oncpu = offsetof(struct thread, td_oncpu)
 
const int thread_off_td_pcb = offsetof(struct thread, td_pcb)
 
const int thread_off_td_plist = offsetof(struct thread, td_plist)
 
int kstack_pages = KSTACK_PAGES
 
static int vmmap_skip_res_cnt = 0
 
static bitstr_t * proc_id_array []
 
int allproc_gen
 

Macro Definition Documentation

◆ GET_PS_STRINGS_CHUNK_SZ

#define GET_PS_STRINGS_CHUNK_SZ   256 /* Chunk size (bytes) for ps_strings operations. */

Definition at line 1989 of file kern_proc.c.

◆ PROC_AUXV_MAX

#define PROC_AUXV_MAX   256 /* Safety limit on auxv size. */

Definition at line 1819 of file kern_proc.c.

Enumeration Type Documentation

◆ proc_vector_type

Enumerator
PROC_ARG 
PROC_ENV 
PROC_AUX 

Definition at line 1821 of file kern_proc.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _pfind()

static __always_inline struct proc * _pfind ( pid_t  pid,
bool  zombie 
)
static

Definition at line 442 of file kern_proc.c.

Referenced by pfind(), and pfind_any().

Here is the caller graph for this function:

◆ bit_decl() [1/4]

bitstr_t bit_decl ( proc_id_grpidmap  ,
PID_MAX   
)

◆ bit_decl() [2/4]

bitstr_t bit_decl ( proc_id_pidmap  ,
PID_MAX   
)

◆ bit_decl() [3/4]

bitstr_t bit_decl ( proc_id_reapmap  ,
PID_MAX   
)

◆ bit_decl() [4/4]

bitstr_t bit_decl ( proc_id_sessidmap  ,
PID_MAX   
)

◆ CTASSERT()

CTASSERT ( sizeof(struct kinfo_proc)  = =KINFO_PROC_SIZE)

◆ doenterpgrp()

static void doenterpgrp ( struct proc *  p,
struct pgrp *  pgrp 
)
static

Definition at line 723 of file kern_proc.c.

References isjobproc(), jobc_parent(), orphanpg(), pgdelete(), pgrp_calc_jobc(), and proctree_lock.

Referenced by enterpgrp(), and enterthispgrp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enterpgrp()

int enterpgrp ( struct proc *  p,
pid_t  pgid,
struct pgrp *  pgrp,
struct session *  sess 
)

Definition at line 575 of file kern_proc.c.

References doenterpgrp(), pgfind(), proc_id_set(), proctree_lock, and sess_hold().

Referenced by sys_setpgid(), and sys_setsid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enterthispgrp()

int enterthispgrp ( struct proc *  p,
struct pgrp *  pgrp 
)

Definition at line 636 of file kern_proc.c.

References doenterpgrp(), and proctree_lock.

Referenced by sys_setpgid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EVENTHANDLER_LIST_DEFINE() [1/7]

EVENTHANDLER_LIST_DEFINE ( process_ctor  )

◆ EVENTHANDLER_LIST_DEFINE() [2/7]

EVENTHANDLER_LIST_DEFINE ( process_dtor  )

◆ EVENTHANDLER_LIST_DEFINE() [3/7]

EVENTHANDLER_LIST_DEFINE ( process_exec  )

◆ EVENTHANDLER_LIST_DEFINE() [4/7]

EVENTHANDLER_LIST_DEFINE ( process_exit  )

◆ EVENTHANDLER_LIST_DEFINE() [5/7]

EVENTHANDLER_LIST_DEFINE ( process_fini  )

◆ EVENTHANDLER_LIST_DEFINE() [6/7]

EVENTHANDLER_LIST_DEFINE ( process_fork  )

◆ EVENTHANDLER_LIST_DEFINE() [7/7]

EVENTHANDLER_LIST_DEFINE ( process_init  )

◆ fill_kinfo_aggregate()

static void fill_kinfo_aggregate ( struct proc *  p,
struct kinfo_proc *  kp 
)
static

Definition at line 1029 of file kern_proc.c.

References sched_estcpu(), and sched_pctcpu().

Referenced by fill_kinfo_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_kinfo_proc()

void fill_kinfo_proc ( struct proc *  p,
struct kinfo_proc *  kp 
)

Definition at line 1330 of file kern_proc.c.

References fill_kinfo_aggregate(), fill_kinfo_proc_only(), fill_kinfo_proc_pgrp(), and fill_kinfo_thread().

Referenced by kern_proc_out().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_kinfo_proc_only()

static void fill_kinfo_proc_only ( struct proc *  p,
struct kinfo_proc *  kp 
)
static

Definition at line 1050 of file kern_proc.c.

References calccru(), calcru(), cputick2usec(), getboottime(), hz, rufetch(), ticks, and timevaladd().

Referenced by fill_kinfo_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_kinfo_proc_pgrp()

static void fill_kinfo_proc_pgrp ( struct proc *  p,
struct kinfo_proc *  kp 
)
static

Definition at line 1170 of file kern_proc.c.

References pgrp_calc_jobc(), proctree_lock, and tty_udev().

Referenced by fill_kinfo_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_kinfo_thread()

static void fill_kinfo_thread ( struct thread *  td,
struct kinfo_proc *  kp,
int  preferthread 
)
static

Definition at line 1220 of file kern_proc.c.

References cputick2usec(), hz, rufetchtd(), sched_estcpu(), sched_pctcpu(), and ticks.

Referenced by fill_kinfo_proc(), and kern_proc_out().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fixjobc_kill()

static void fixjobc_kill ( struct proc *  p)
static

Definition at line 814 of file kern_proc.c.

References isjobproc(), jobc_parent(), orphanpg(), pgrp_calc_jobc(), and proctree_lock.

Referenced by killjobc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_proc_vector()

static int get_proc_vector ( struct thread *  td,
struct proc *  p,
char ***  proc_vectorp,
size_t *  vsizep,
enum proc_vector_type  type 
)
static

Definition at line 1903 of file kern_proc.c.

References free(), malloc(), PROC_ARG, PROC_AUX, PROC_AUXV_MAX, PROC_ENV, proc_readmem(), and type.

Referenced by get_ps_strings(), and proc_getauxv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ps_strings()

static int get_ps_strings ( struct thread *  td,
struct proc *  p,
struct sbuf *  sb,
enum proc_vector_type  type 
)
static

Definition at line 1992 of file kern_proc.c.

References free(), get_proc_vector(), GET_PS_STRINGS_CHUNK_SZ, proc_read_string(), sbuf_bcat(), and type.

Referenced by proc_getargv(), and proc_getenvv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inferior()

int inferior ( struct proc *  p)

Definition at line 377 of file kern_proc.c.

References proc_realparent(), and proctree_lock.

Referenced by sys_setpgid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isjobproc()

static bool isjobproc ( struct proc *  q,
struct pgrp *  pgrp 
)
static

Definition at line 660 of file kern_proc.c.

References proctree_lock.

Referenced by doenterpgrp(), fixjobc_kill(), and pgrp_calc_jobc().

Here is the caller graph for this function:

◆ jobc_parent()

static struct proc * jobc_parent ( struct proc *  p,
struct proc *  p_exiting 
)
static

Definition at line 684 of file kern_proc.c.

References jobc_reaper(), proc_realparent(), and proctree_lock.

Referenced by doenterpgrp(), fixjobc_kill(), and pgrp_calc_jobc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ jobc_reaper()

static struct proc * jobc_reaper ( struct proc *  p)
static

Definition at line 669 of file kern_proc.c.

References proctree_lock.

Referenced by jobc_parent().

Here is the caller graph for this function:

◆ kern_proc_out()

int kern_proc_out ( struct proc *  p,
struct sbuf *  sb,
int  flags 
)

Definition at line 1508 of file kern_proc.c.

References fill_kinfo_proc(), fill_kinfo_thread(), flags, and sbuf_bcat().

Referenced by note_procstat_proc(), and sysctl_out_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_proc_out_size()

static ssize_t kern_proc_out_size ( struct proc *  p,
int  flags 
)
static

Definition at line 1482 of file kern_proc.c.

References flags.

Referenced by sysctl_out_proc().

Here is the caller graph for this function:

◆ kern_proc_vmmap_out()

int kern_proc_vmmap_out ( struct proc *  p,
struct sbuf *  sb,
ssize_t  maxlen,
int  flags 
)

Definition at line 2575 of file kern_proc.c.

References addr, flags, free(), kern_proc_vmmap_resident(), malloc(), sbuf_bcat(), vn_fullpath(), vntype_to_kinfo(), vput(), and vref().

Referenced by note_procstat_vmmap(), and sysctl_kern_proc_vmmap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_proc_vmmap_resident()

void kern_proc_vmmap_resident ( vm_map_t  map,
vm_map_entry_t  entry,
int *  resident_count,
bool *  super 
)

Definition at line 2509 of file kern_proc.c.

References addr, pagesizes, and vmmap_skip_res_cnt.

Referenced by kern_proc_vmmap_out().

Here is the caller graph for this function:

◆ killjobc()

void killjobc ( void  )

Definition at line 877 of file kern_proc.c.

References fixjobc_kill(), proctree_lock, and tty_signal_pgrp().

Referenced by exit1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leavepgrp()

int leavepgrp ( struct proc *  p)

Definition at line 758 of file kern_proc.c.

References pgdelete(), and proctree_lock.

Referenced by proc_reap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MALLOC_DEFINE() [1/3]

static MALLOC_DEFINE ( M_PROC  ,
"proc"  ,
"Proc structures"   
)
static

◆ MALLOC_DEFINE() [2/3]

MALLOC_DEFINE ( M_SESSION  ,
"session"  ,
"session header"   
)

◆ MALLOC_DEFINE() [3/3]

MALLOC_DEFINE ( M_SUBPROC  ,
"subproc"  ,
"Proc sub-structures"   
)

◆ orphanpg()

static void orphanpg ( struct pgrp *  pg)
static

Definition at line 942 of file kern_proc.c.

References kern_psignal().

Referenced by doenterpgrp(), and fixjobc_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pargs_alloc()

struct pargs * pargs_alloc ( int  len)

Definition at line 1765 of file kern_proc.c.

References malloc().

Referenced by do_execve(), and sysctl_kern_proc_args().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pargs_drop()

void pargs_drop ( struct pargs *  pa)

Definition at line 1793 of file kern_proc.c.

References pargs_free().

Referenced by do_execve(), proc_reap(), and sysctl_kern_proc_args().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pargs_free()

static void pargs_free ( struct pargs *  pa)
static

Definition at line 1777 of file kern_proc.c.

References free().

Referenced by pargs_drop(), and sysctl_kern_proc_args().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pargs_hold()

void pargs_hold ( struct pargs *  pa)

Definition at line 1784 of file kern_proc.c.

Referenced by do_fork(), and sysctl_kern_proc_args().

Here is the caller graph for this function:

◆ pfind()

struct proc * pfind ( pid_t  pid)

Definition at line 468 of file kern_proc.c.

References _pfind().

Referenced by cpuset_which(), filt_procattach(), kern_getpriority(), kern_getsid(), kern_procctl(), kern_ptrace(), kern_setpriority(), pget(), sys_getpgid(), sys_ktrace(), sys_rtprio(), sys_setpgid(), and sys_thr_kill2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfind_any()

struct proc * pfind_any ( pid_t  pid)

Definition at line 478 of file kern_proc.c.

References _pfind().

Referenced by filt_procattach(), kern_kill(), kern_sigqueue(), and pget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pfind_any_locked()

struct proc * pfind_any_locked ( pid_t  pid)

Definition at line 417 of file kern_proc.c.

◆ pgdelete()

static void pgdelete ( struct pgrp *  pgrp)
static

Definition at line 779 of file kern_proc.c.

References funsetownlst(), pgrp_zone, proc_id_clear(), proctree_lock, sess_release(), and tty_rel_pgrp().

Referenced by doenterpgrp(), and leavepgrp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pget()

◆ pgfind()

struct pgrp * pgfind ( pid_t  pgid)

Definition at line 489 of file kern_proc.c.

References proctree_lock.

Referenced by enterpgrp(), fsetown(), gsignal(), kern_getpriority(), kern_procctl(), kern_setpriority(), killpg1(), sys_ktrace(), sys_setpgid(), sys_setsid(), and tty_generic_ioctl().

Here is the caller graph for this function:

◆ pgrp_calc_jobc()

static int pgrp_calc_jobc ( struct pgrp *  pgrp)
static

Definition at line 698 of file kern_proc.c.

References isjobproc(), jobc_parent(), and proctree_lock.

Referenced by doenterpgrp(), fill_kinfo_proc_pgrp(), and fixjobc_kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pgrp_init()

static int pgrp_init ( void *  mem,
int  size,
int  flags 
)
static

Definition at line 308 of file kern_proc.c.

Referenced by procinit().

Here is the caller graph for this function:

◆ pidhash_slockall()

void pidhash_slockall ( void  )

Definition at line 393 of file kern_proc.c.

References pidhashlock, and pidhashtbl_lock.

◆ pidhash_sunlockall()

void pidhash_sunlockall ( void  )

Definition at line 405 of file kern_proc.c.

References pidhashlock, and pidhashtbl_lock.

◆ proc_ctor()

static int proc_ctor ( void *  mem,
int  size,
void *  arg,
int  flags 
)
static

Definition at line 211 of file kern_proc.c.

References kdtrace_proc_ctor(), and thread_ctor().

Referenced by procinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_dtor()

static void proc_dtor ( void *  mem,
int  size,
void *  arg 
)
static

Definition at line 233 of file kern_proc.c.

References kdtrace_proc_dtor(), and thread_dtor().

Referenced by procinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_fini()

static void proc_fini ( void *  mem,
int  size 
)
static

Definition at line 290 of file kern_proc.c.

References ksiginfo_free(), panic(), pstats_free(), and thread_free().

Referenced by procinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_get_binpath()

int proc_get_binpath ( struct proc *  p,
char *  binname,
char **  retbuf,
char **  freebuf 
)

Definition at line 2241 of file kern_proc.c.

References free(), namei(), NDFREE(), vn_fullpath(), vn_fullpath_hardlink(), vref(), and vrele().

Referenced by sysctl_kern_proc_pathname().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_getargv()

int proc_getargv ( struct thread *  td,
struct proc *  p,
struct sbuf *  sb 
)

Definition at line 2040 of file kern_proc.c.

References get_ps_strings(), and PROC_ARG.

Referenced by note_prpsinfo(), and sysctl_kern_proc_args().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_getauxv()

int proc_getauxv ( struct thread *  td,
struct proc *  p,
struct sbuf *  sb 
)

Definition at line 2054 of file kern_proc.c.

References free(), get_proc_vector(), PROC_AUX, and sbuf_bcat().

Referenced by note_procstat_auxv(), and sysctl_kern_proc_auxv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_getenvv()

int proc_getenvv ( struct thread *  td,
struct proc *  p,
struct sbuf *  sb 
)

Definition at line 2047 of file kern_proc.c.

References get_ps_strings(), and PROC_ENV.

Referenced by sysctl_kern_proc_env().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_id_clear()

void proc_id_clear ( int  type,
pid_t  id 
)

Definition at line 361 of file kern_proc.c.

References proc_id_array, procid_lock, and type.

Referenced by pgdelete(), proc_reap(), reaper_clear(), and sess_release().

Here is the caller graph for this function:

◆ proc_id_set()

void proc_id_set ( int  type,
pid_t  id 
)

Definition at line 335 of file kern_proc.c.

References proc_id_array, procid_lock, and type.

Referenced by enterpgrp().

Here is the caller graph for this function:

◆ proc_id_set_cond()

void proc_id_set_cond ( int  type,
pid_t  id 
)

Definition at line 348 of file kern_proc.c.

References proc_id_array, procid_lock, and type.

Referenced by do_fork().

Here is the caller graph for this function:

◆ proc_init()

static int proc_init ( void *  mem,
int  size,
int  flags 
)
static

Definition at line 267 of file kern_proc.c.

References cv_init(), and pstats_alloc().

Referenced by procinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_iterate()

int proc_iterate ( int(*)(struct proc *, void *)  cb,
void *  cbarg 
)

Definition at line 1575 of file kern_proc.c.

References pidhash, pidhashlock, pidhashtbl, pidhashtbl_lock, and proctree_lock.

Referenced by sysctl_kern_proc().

Here is the caller graph for this function:

◆ proc_read_string()

static int proc_read_string ( struct thread *  td,
struct proc *  p,
const char *  sptr,
char *  buf,
size_t  len 
)
static

Definition at line 1803 of file kern_proc.c.

References buf, and proc_readmem().

Referenced by get_ps_strings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ procinit()

void procinit ( void  )

Definition at line 182 of file kern_proc.c.

References allproc_lock, hashinit(), malloc(), maxproc, pgrp_init(), pgrp_zone, pgrphash, pgrphashtbl, pidhash, pidhashlock, pidhashtbl, pidhashtbl_lock, ppeers_lock, proc_ctor(), proc_dtor(), proc_fini(), proc_init(), proc_zone, procid_lock, proctree_lock, sched_sizeof_proc(), sx_init_flags(), and uihashinit().

Referenced by proc0_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pstats_alloc()

struct pstats * pstats_alloc ( void  )

Definition at line 1343 of file kern_proc.c.

References malloc().

Referenced by proc0_init(), and proc_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pstats_fork()

void pstats_fork ( struct pstats *  src,
struct pstats *  dst 
)

Definition at line 1353 of file kern_proc.c.

References src.

Referenced by do_fork().

Here is the caller graph for this function:

◆ pstats_free()

void pstats_free ( struct pstats *  ps)

Definition at line 1363 of file kern_proc.c.

References free().

Referenced by proc_fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resume_all_proc()

void resume_all_proc ( void  )

Definition at line 3471 of file kern_proc.c.

References allproc, allproc_lock, and thread_single_end().

Here is the call graph for this function:

◆ SDT_PROVIDER_DEFINE()

SDT_PROVIDER_DEFINE ( proc  )

◆ sess_hold()

void sess_hold ( struct session *  s)

Definition at line 967 of file kern_proc.c.

Referenced by enterpgrp(), and vtprintf().

Here is the caller graph for this function:

◆ sess_release()

void sess_release ( struct session *  s)

Definition at line 974 of file kern_proc.c.

References free(), proc_id_clear(), and tty_rel_sess().

Referenced by pgdelete(), and vtprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_all_proc()

void stop_all_proc ( void  )

Definition at line 3408 of file kern_proc.c.

References allproc, allproc_gen, allproc_lock, kern_yield(), and thread_single().

Here is the call graph for this function:

◆ SYSCTL_INT() [1/2]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
kstack_pages  ,
CTLFLAG_RD  ,
kstack_pages,
,
"Kernel stack size in pages"   
)

◆ SYSCTL_INT() [2/2]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
proc_vmmap_skip_resident_count  ,
CTLFLAG_RW  ,
vmmap_skip_res_cnt,
,
"Skip calculation of the pages resident count in kern.proc.vmmap"   
)

◆ sysctl_kern_proc()

static int sysctl_kern_proc ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_kern_proc_args()

static int sysctl_kern_proc_args ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_kern_proc_auxv()

static int sysctl_kern_proc_auxv ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2201 of file kern_proc.c.

References GET_PS_STRINGS_CHUNK_SZ, name, pget(), proc_getauxv(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().

Here is the call graph for this function:

◆ sysctl_kern_proc_env()

static int sysctl_kern_proc_env ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2168 of file kern_proc.c.

References GET_PS_STRINGS_CHUNK_SZ, name, pget(), proc_getenvv(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().

Here is the call graph for this function:

◆ sysctl_kern_proc_groups()

static int sysctl_kern_proc_groups ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2867 of file kern_proc.c.

References crfree(), crhold(), and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_iterate()

static int sysctl_kern_proc_iterate ( struct proc *  p,
void *  origarg 
)
static

Definition at line 1610 of file kern_proc.c.

References kern_proc_out_args::flags, flags, name, kern_proc_out_args::name, kern_proc_out_args::oid_number, p_cansee(), kern_proc_out_args::req, sysctl_out_proc(), and tty_udev().

Referenced by sysctl_kern_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sysctl_kern_proc_osrel()

static int sysctl_kern_proc_osrel ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3034 of file kern_proc.c.

References flags, name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_pathname()

static int sysctl_kern_proc_pathname ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2304 of file kern_proc.c.

References free(), malloc(), pget(), and proc_get_binpath().

Here is the call graph for this function:

◆ sysctl_kern_proc_ps_strings()

static int sysctl_kern_proc_ps_strings ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2959 of file kern_proc.c.

References name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_rlimit()

static int sysctl_kern_proc_rlimit ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2900 of file kern_proc.c.

References flags, kern_proc_setrlimit(), lim_rlimit_proc(), name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_sigfastblk()

static int sysctl_kern_proc_sigfastblk ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3133 of file kern_proc.c.

References addr, name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_sigtramp()

static int sysctl_kern_proc_sigtramp ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3076 of file kern_proc.c.

References name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_sv_name()

static int sysctl_kern_proc_sv_name ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2335 of file kern_proc.c.

References name, pget(), and sysctl_handle_string().

Here is the call graph for this function:

◆ sysctl_kern_proc_umask()

static int sysctl_kern_proc_umask ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2999 of file kern_proc.c.

References name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_vm_layout()

static int sysctl_kern_proc_vm_layout ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3204 of file kern_proc.c.

References name, and pget().

Here is the call graph for this function:

◆ sysctl_kern_proc_vmmap()

static int sysctl_kern_proc_vmmap ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 2746 of file kern_proc.c.

References kern_proc_vmmap_out(), name, pget(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().

Here is the call graph for this function:

◆ SYSCTL_NODE() [1/33]

SYSCTL_NODE ( _kern  ,
KERN_PROC  ,
proc  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"Process table"   
)

◆ SYSCTL_NODE() [2/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_ARGS  ,
args  ,
CTLFLAG_RW|CTLFLAG_CAPWR|CTLFLAG_ANYBODY|  CTLFLAG_MPSAFE,
sysctl_kern_proc_args  ,
"Process argument list"   
)
static

◆ SYSCTL_NODE() [3/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_AUXV  ,
auxv  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_auxv  ,
"Process ELF auxiliary vector"   
)
static

◆ SYSCTL_NODE() [4/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_ENV  ,
env  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_env  ,
"Process environment"   
)
static

◆ SYSCTL_NODE() [5/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_GID  ,
gid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [6/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_GROUPS  ,
groups  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_groups  ,
"Process groups"   
)
static

◆ SYSCTL_NODE() [7/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_OSREL  ,
osrel  ,
CTLFLAG_RW|CTLFLAG_ANYBODY|  CTLFLAG_MPSAFE,
sysctl_kern_proc_osrel  ,
"Process binary osreldate"   
)
static

◆ SYSCTL_NODE() [8/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_PATHNAME  ,
pathname  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_pathname  ,
"Process executable path  
)
static

◆ SYSCTL_NODE() [9/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_PGRP  ,
pgrp  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [10/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_PID  ,
pid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [11/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_PROC  ,
proc  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Return process  table,
no threads"   
)
static

◆ SYSCTL_NODE() [12/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_PS_STRINGS  ,
ps_strings  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_ps_strings  ,
"Process ps_strings location"   
)
static

◆ SYSCTL_NODE() [13/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_RGID  ,
rgid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [14/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_RLIMIT  ,
rlimit  ,
CTLFLAG_RW|CTLFLAG_ANYBODY|  CTLFLAG_MPSAFE,
sysctl_kern_proc_rlimit  ,
"Process resource limits"   
)
static

◆ SYSCTL_NODE() [15/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_RUID  ,
ruid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [16/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_SESSION  ,
sid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [17/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_SIGFASTBLK  ,
sigfastblk  ,
CTLFLAG_RD|CTLFLAG_ANYBODY|  CTLFLAG_MPSAFE,
sysctl_kern_proc_sigfastblk  ,
"Thread sigfastblock address"   
)
static

◆ SYSCTL_NODE() [18/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_SIGTRAMP  ,
sigtramp  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_sigtramp  ,
"Process signal trampoline location"   
)
static

◆ SYSCTL_NODE() [19/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_SV_NAME  ,
sv_name  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_sv_name  ,
"Process syscall vector name (ABI type)"   
)
static

◆ SYSCTL_NODE() [20/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_TTY  ,
tty  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [21/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_UID  ,
uid  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [22/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_UMASK  ,
umask  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_umask  ,
"Process umask"   
)
static

◆ SYSCTL_NODE() [23/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_VM_LAYOUT  ,
vm_layout  ,
CTLFLAG_RD|CTLFLAG_ANYBODY|  CTLFLAG_MPSAFE,
sysctl_kern_proc_vm_layout  ,
"Process virtual address space layout info"   
)
static

◆ SYSCTL_NODE() [24/33]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_VMMAP  ,
vmmap  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_vmmap  ,
"Process vm map entries"   
)
static

◆ SYSCTL_NODE() [25/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_GID|KERN_PROC_INC_THREAD)  ,
gid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [26/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_PGRP|KERN_PROC_INC_THREAD)  ,
pgrp_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [27/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_PID|KERN_PROC_INC_THREAD)  ,
pid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [28/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_PROC|KERN_PROC_INC_THREAD)  ,
proc_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Return process  table,
including threads"   
)
static

◆ SYSCTL_NODE() [29/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_RGID|KERN_PROC_INC_THREAD)  ,
rgid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [30/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_RUID|KERN_PROC_INC_THREAD)  ,
ruid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [31/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_SESSION|KERN_PROC_INC_THREAD)  ,
sid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [32/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_TTY|KERN_PROC_INC_THREAD)  ,
tty_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ SYSCTL_NODE() [33/33]

static SYSCTL_NODE ( _kern_proc  ,
(KERN_PROC_UID|KERN_PROC_INC_THREAD)  ,
uid_td  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc  ,
"Process table"   
)
static

◆ sysctl_out_proc()

static int sysctl_out_proc ( struct proc *  p,
struct sysctl_req *  req,
int  flags 
)
static

Definition at line 1553 of file kern_proc.c.

References flags, kern_proc_out(), kern_proc_out_size(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().

Referenced by sysctl_kern_proc(), and sysctl_kern_proc_iterate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SYSCTL_PROC()

SYSCTL_PROC ( _kern_proc  ,
KERN_PROC_ALL  ,
all  ,
CTLFLAG_RD|CTLTYPE_STRUCT|  CTLFLAG_MPSAFE,
,
,
sysctl_kern_proc  ,
S,
proc"  ,
"Return entire process table"   
)

Variable Documentation

◆ allproc

struct proclist allproc = LIST_HEAD_INITIALIZER(allproc)

Definition at line 133 of file kern_proc.c.

Referenced by do_fork(), proc0_init(), resume_all_proc(), and stop_all_proc().

◆ allproc_gen

int allproc_gen

Definition at line 3399 of file kern_proc.c.

Referenced by do_fork(), and stop_all_proc().

◆ allproc_lock

◆ kstack_pages

int kstack_pages = KSTACK_PAGES

Definition at line 165 of file kern_proc.c.

Referenced by fork1(), and init_param1().

◆ pgrp_zone

uma_zone_t pgrp_zone

Definition at line 139 of file kern_proc.c.

Referenced by pgdelete(), procinit(), sys_setpgid(), and sys_setsid().

◆ pgrphash

u_long pgrphash

Definition at line 132 of file kern_proc.c.

Referenced by procinit().

◆ pgrphashtbl

struct pgrphashhead* pgrphashtbl

Definition at line 131 of file kern_proc.c.

Referenced by procinit().

◆ pidhash

u_long pidhash

Definition at line 129 of file kern_proc.c.

Referenced by kdb_thr_first(), kdb_thr_next(), proc_iterate(), and procinit().

◆ pidhashlock

u_long pidhashlock

Definition at line 130 of file kern_proc.c.

Referenced by pidhash_slockall(), pidhash_sunlockall(), proc_iterate(), and procinit().

◆ pidhashtbl

struct pidhashhead* pidhashtbl = NULL

Definition at line 127 of file kern_proc.c.

Referenced by kdb_thr_first(), kdb_thr_next(), proc_iterate(), and procinit().

◆ pidhashtbl_lock

struct sx* pidhashtbl_lock

Definition at line 128 of file kern_proc.c.

Referenced by pidhash_slockall(), pidhash_sunlockall(), proc_iterate(), and procinit().

◆ ppeers_lock

struct mtx __exclusive_cache_line ppeers_lock

Definition at line 136 of file kern_proc.c.

Referenced by do_fork(), exit1(), and procinit().

◆ proc_id_array

bitstr_t* proc_id_array[]
static
Initial value:
= {
}
bitstr_t proc_id_reapmap
bitstr_t proc_id_pidmap
bitstr_t proc_id_grpidmap
bitstr_t proc_id_sessidmap

Definition at line 327 of file kern_proc.c.

Referenced by proc_id_clear(), proc_id_set(), and proc_id_set_cond().

◆ proc_off_p_comm

const int proc_off_p_comm = offsetof(struct proc, p_comm)

Definition at line 147 of file kern_proc.c.

◆ proc_off_p_hash

const int proc_off_p_hash = offsetof(struct proc, p_hash)

Definition at line 149 of file kern_proc.c.

◆ proc_off_p_list

const int proc_off_p_list = offsetof(struct proc, p_list)

Definition at line 148 of file kern_proc.c.

◆ proc_off_p_pid

const int proc_off_p_pid = offsetof(struct proc, p_pid)

Definition at line 146 of file kern_proc.c.

◆ proc_off_p_threads

const int proc_off_p_threads = offsetof(struct proc, p_threads)

Definition at line 150 of file kern_proc.c.

◆ proc_zone

uma_zone_t proc_zone

Definition at line 138 of file kern_proc.c.

Referenced by fork1(), proc_reap(), and procinit().

◆ procid_lock

struct mtx __exclusive_cache_line procid_lock

Definition at line 137 of file kern_proc.c.

Referenced by fork_findpid(), proc_id_clear(), proc_id_set(), proc_id_set_cond(), and procinit().

◆ proctree_lock

◆ thread_off_td_name

const int thread_off_td_name = offsetof(struct thread, td_name)

Definition at line 152 of file kern_proc.c.

◆ thread_off_td_oncpu

const int thread_off_td_oncpu = offsetof(struct thread, td_oncpu)

Definition at line 153 of file kern_proc.c.

◆ thread_off_td_pcb

const int thread_off_td_pcb = offsetof(struct thread, td_pcb)

Definition at line 154 of file kern_proc.c.

◆ thread_off_td_plist

const int thread_off_td_plist = offsetof(struct thread, td_plist)

Definition at line 155 of file kern_proc.c.

◆ thread_off_td_tid

const int thread_off_td_tid = offsetof(struct thread, td_tid)

Definition at line 151 of file kern_proc.c.

◆ vmmap_skip_res_cnt

int vmmap_skip_res_cnt = 0
static

Definition at line 168 of file kern_proc.c.

Referenced by kern_proc_vmmap_resident().