FreeBSD kernel kern code
subr_param.c File Reference
#include <sys/cdefs.h>
#include "opt_param.h"
#include "opt_msgbuf.h"
#include "opt_maxphys.h"
#include "opt_maxusers.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/msgbuf.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
Include dependency graph for subr_param.c:

Go to the source code of this file.

Macros

#define HZ   1000
 
#define HZ_VM   100
 
#define NPROC   (20 + 16 * maxusers)
 
#define NBUF   0
 
#define MAXFILES   (40 + 32 * maxusers)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int sysctl_kern_vm_guest (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_INT (_kern, OID_AUTO, hz, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &hz, 0, "Number of clock ticks per second")
 
 SYSCTL_INT (_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &nbuf, 0, "Number of buffers in the buffer cache")
 
 SYSCTL_INT (_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &nswbuf, 0, "Number of swap buffers")
 
 SYSCTL_INT (_kern, OID_AUTO, msgbufsize, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &msgbufsize, 0, "Size of the kernel message buffer")
 
 SYSCTL_LONG (_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &maxswzone, 0, "Maximum memory for swap metadata")
 
 SYSCTL_LONG (_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &maxbcache, 0, "Maximum value of vfs.maxbufspace")
 
 SYSCTL_INT (_kern, OID_AUTO, bio_transient_maxcnt, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &bio_transient_maxcnt, 0, "Maximum number of transient BIOs mappings")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxtsiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &maxtsiz, 0, "Maximum text size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, dfldsiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &dfldsiz, 0, "Initial data size limit")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxdsiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &maxdsiz, 0, "Maximum data size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, dflssiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &dflssiz, 0, "Initial stack size limit")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxssiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &maxssiz, 0, "Maximum stack size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, sgrowsiz, CTLFLAG_RWTUN|CTLFLAG_NOFETCH, &sgrowsiz, 0, "Amount to grow stack on a stack fault")
 
 SYSCTL_PROC (_kern, OID_AUTO, vm_guest, CTLFLAG_RD|CTLTYPE_STRING|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_vm_guest, "A", "Virtual machine guest detected?")
 
 CTASSERT (nitems(vm_guest_sysctl_names) - 1==VM_LAST)
 
void init_param1 (void)
 
void init_param2 (long physpages)
 

Variables

int hz
 
int tick
 
struct bintime tick_bt
 
sbintime_t tick_sbt
 
int maxusers
 
int maxproc
 
int maxprocperuid
 
int maxfiles
 
int maxfilesperproc
 
int msgbufsize
 
int nbuf
 
int bio_transient_maxcnt
 
int ngroups_max
 
int nswbuf
 
pid_t pid_max = PID_MAX
 
u_long maxswzone
 
u_long maxbcache
 
u_long maxpipekva
 
u_long maxphys
 
int vm_guest = VM_GUEST_NO
 
u_long maxtsiz
 
u_long dfldsiz
 
u_long maxdsiz
 
u_long dflssiz
 
u_long maxssiz
 
u_long sgrowsiz
 
static const char *const vm_guest_sysctl_names []
 

Macro Definition Documentation

◆ HZ

#define HZ   1000

Definition at line 66 of file subr_param.c.

◆ HZ_VM

#define HZ_VM   100

Definition at line 68 of file subr_param.c.

◆ MAXFILES

#define MAXFILES   (40 + 32 * maxusers)

Definition at line 80 of file subr_param.c.

◆ NBUF

#define NBUF   0

Definition at line 77 of file subr_param.c.

◆ NPROC

#define NPROC   (20 + 16 * maxusers)

Definition at line 75 of file subr_param.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ CTASSERT()

CTASSERT ( nitems(vm_guest_sysctl_names) -  1 = =VM_LAST)

◆ init_param1()

◆ init_param2()

void init_param2 ( long  physpages)

◆ SYSCTL_INT() [1/5]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
bio_transient_maxcnt  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
bio_transient_maxcnt,
,
"Maximum number of transient BIOs mappings"   
)

◆ SYSCTL_INT() [2/5]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
hz  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
hz,
,
"Number of clock ticks per second"   
)

◆ SYSCTL_INT() [3/5]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
msgbufsize  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
msgbufsize,
,
"Size of the kernel message buffer"   
)

◆ SYSCTL_INT() [4/5]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nbuf  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
nbuf,
,
"Number of buffers in the buffer cache"   
)

◆ SYSCTL_INT() [5/5]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nswbuf  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
nswbuf,
,
"Number of swap buffers"   
)

◆ sysctl_kern_vm_guest()

static int sysctl_kern_vm_guest ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 331 of file subr_param.c.

References vm_guest, and vm_guest_sysctl_names.

◆ SYSCTL_LONG() [1/2]

SYSCTL_LONG ( _kern  ,
OID_AUTO  ,
maxbcache  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
maxbcache,
,
"Maximum value of vfs.maxbufspace  
)

◆ SYSCTL_LONG() [2/2]

SYSCTL_LONG ( _kern  ,
OID_AUTO  ,
maxswzone  ,
CTLFLAG_RDTUN|  CTLFLAG_NOFETCH,
maxswzone,
,
"Maximum memory for swap metadata"   
)

◆ SYSCTL_PROC()

SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
vm_guest  ,
CTLFLAG_RD|CTLTYPE_STRING|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_kern_vm_guest  ,
"A"  ,
"Virtual machine guest detected?"   
)

◆ SYSCTL_ULONG() [1/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
dfldsiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
dfldsiz,
,
"Initial data size limit"   
)

◆ SYSCTL_ULONG() [2/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
dflssiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
dflssiz,
,
"Initial stack size limit"   
)

◆ SYSCTL_ULONG() [3/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxdsiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
maxdsiz,
,
"Maximum data size"   
)

◆ SYSCTL_ULONG() [4/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxssiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
maxssiz,
,
"Maximum stack size"   
)

◆ SYSCTL_ULONG() [5/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxtsiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
maxtsiz,
,
"Maximum text size"   
)

◆ SYSCTL_ULONG() [6/6]

SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
sgrowsiz  ,
CTLFLAG_RWTUN|  CTLFLAG_NOFETCH,
sgrowsiz,
,
"Amount to grow stack on a stack fault"   
)

Variable Documentation

◆ bio_transient_maxcnt

int bio_transient_maxcnt

Definition at line 96 of file subr_param.c.

Referenced by init_param2(), and kern_vfs_bio_buffer_alloc().

◆ dfldsiz

u_long dfldsiz

Definition at line 106 of file subr_param.c.

Referenced by init_param1(), and proc0_init().

◆ dflssiz

u_long dflssiz

Definition at line 108 of file subr_param.c.

Referenced by init_param1(), and proc0_init().

◆ hz

◆ maxbcache

u_long maxbcache

Definition at line 101 of file subr_param.c.

Referenced by init_param1(), and kern_vfs_bio_buffer_alloc().

◆ maxdsiz

u_long maxdsiz

Definition at line 107 of file subr_param.c.

Referenced by init_param1(), kern_proc_setrlimit(), and proc0_init().

◆ maxfiles

◆ maxfilesperproc

int maxfilesperproc

Definition at line 93 of file subr_param.c.

Referenced by getmaxfd(), init_param2(), kern_poll_maxfds(), and kern_proc_setrlimit().

◆ maxphys

◆ maxpipekva

u_long maxpipekva

Definition at line 102 of file subr_param.c.

Referenced by init_param2(), pipe_create(), pipe_read(), and pipe_write().

◆ maxproc

int maxproc

◆ maxprocperuid

int maxprocperuid

Definition at line 91 of file subr_param.c.

Referenced by init_param2(), and kern_proc_setrlimit().

◆ maxssiz

u_long maxssiz

Definition at line 109 of file subr_param.c.

Referenced by exec_map_stack(), init_param1(), kern_proc_setrlimit(), and proc0_init().

◆ maxswzone

u_long maxswzone

Definition at line 100 of file subr_param.c.

Referenced by init_param1().

◆ maxtsiz

u_long maxtsiz

Definition at line 105 of file subr_param.c.

Referenced by enforce_limits(), exec_aout_imgact(), and init_param1().

◆ maxusers

int maxusers

Definition at line 89 of file subr_param.c.

Referenced by init_param2().

◆ msgbufsize

int msgbufsize

Definition at line 94 of file subr_param.c.

Referenced by init_param1().

◆ nbuf

◆ ngroups_max

int ngroups_max

Definition at line 97 of file subr_param.c.

Referenced by crsetgroups(), init_param1(), kern_setgroups(), and sys_setgroups().

◆ nswbuf

int nswbuf

Definition at line 98 of file subr_param.c.

Referenced by cluster_init(), init_param2(), and kern_vfs_bio_buffer_alloc().

◆ pid_max

pid_t pid_max = PID_MAX

◆ sgrowsiz

u_long sgrowsiz

Definition at line 110 of file subr_param.c.

Referenced by exec_map_stack(), and init_param1().

◆ tick

◆ tick_bt

struct bintime tick_bt

Definition at line 87 of file subr_param.c.

Referenced by cpu_initclocks_bsp(), init_param1(), and inittimecounter().

◆ tick_sbt

◆ vm_guest

int vm_guest = VM_GUEST_NO

Definition at line 104 of file subr_param.c.

Referenced by calcru1(), init_param1(), and sysctl_kern_vm_guest().

◆ vm_guest_sysctl_names

const char* const vm_guest_sysctl_names[]
static
Initial value:
= {
[VM_GUEST_NO] = "none",
[VM_GUEST_VM] = "generic",
[VM_GUEST_XEN] = "xen",
[VM_GUEST_HV] = "hv",
[VM_GUEST_VMWARE] = "vmware",
[VM_GUEST_KVM] = "kvm",
[VM_GUEST_BHYVE] = "bhyve",
[VM_GUEST_VBOX] = "vbox",
[VM_GUEST_PARALLELS] = "parallels",
[VM_LAST] = NULL
}

Definition at line 148 of file subr_param.c.

Referenced by sysctl_kern_vm_guest().