FreeBSD kernel kern code
subr_param.c File Reference
#include <sys/cdefs.h>
#include "opt_param.h"
#include "opt_msgbuf.h"
#include "opt_maxusers.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/msgbuf.h>
#include <sys/sysctl.h>
#include <sys/proc.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   (maxproc * 2)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static int sysctl_kern_vm_guest (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_INT (_kern, OID_AUTO, hz, CTLFLAG_RDTUN,&hz, 0,"Number of clock ticks per second")
 
 SYSCTL_INT (_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN,&ncallout, 0,"Number of pre-allocated timer events")
 
 SYSCTL_INT (_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN,&nbuf, 0,"Number of buffers in the buffer cache")
 
 SYSCTL_INT (_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN,&nswbuf, 0,"Number of swap buffers")
 
 SYSCTL_INT (_kern, OID_AUTO, msgbufsize, CTLFLAG_RDTUN,&msgbufsize, 0,"Size of the kernel message buffer")
 
 SYSCTL_LONG (_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN,&maxswzone, 0,"Maximum memory for swap metadata")
 
 SYSCTL_LONG (_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN,&maxbcache, 0,"Maximum value of vfs.maxbufspace")
 
 SYSCTL_INT (_kern, OID_AUTO, bio_transient_maxcnt, CTLFLAG_RDTUN,&bio_transient_maxcnt, 0,"Maximum number of transient BIOs mappings")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxtsiz, CTLFLAG_RW|CTLFLAG_TUN,&maxtsiz, 0,"Maximum text size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, dfldsiz, CTLFLAG_RW|CTLFLAG_TUN,&dfldsiz, 0,"Initial data size limit")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxdsiz, CTLFLAG_RW|CTLFLAG_TUN,&maxdsiz, 0,"Maximum data size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, dflssiz, CTLFLAG_RW|CTLFLAG_TUN,&dflssiz, 0,"Initial stack size limit")
 
 SYSCTL_ULONG (_kern, OID_AUTO, maxssiz, CTLFLAG_RW|CTLFLAG_TUN,&maxssiz, 0,"Maximum stack size")
 
 SYSCTL_ULONG (_kern, OID_AUTO, sgrowsiz, CTLFLAG_RW|CTLFLAG_TUN,&sgrowsiz, 0,"Amount to grow stack on a stack fault")
 
 SYSCTL_PROC (_kern, OID_AUTO, vm_guest, CTLFLAG_RD|CTLTYPE_STRING, NULL, 0, sysctl_kern_vm_guest,"A","Virtual machine guest detected? (none|generic|xen)")
 
static enum VM_GUEST detect_virtual (void)
 
void init_param1 (void)
 
void init_param2 (long physpages)
 

Variables

int hz
 
int tick
 
int maxusers
 
int maxproc
 
int maxprocperuid
 
int maxfiles
 
int maxfilesperproc
 
int msgbufsize
 
int ncallout
 
int nbuf
 
int bio_transient_maxcnt
 
int ngroups_max
 
int nswbuf
 
pid_t pid_max = PID_MAX
 
long maxswzone
 
long maxbcache
 
long maxpipekva
 
int vm_guest
 
u_long maxtsiz
 
u_long dfldsiz
 
u_long maxdsiz
 
u_long dflssiz
 
u_long maxssiz
 
u_long sgrowsiz
 
struct bufswbuf
 
static const char *const vm_guest_sysctl_names []
 
static const char *const vm_bnames []
 
static const char *const vm_pnames []
 

Macro Definition Documentation

#define HZ   1000

Definition at line 64 of file subr_param.c.

Referenced by init_param1().

#define HZ_VM   100

Definition at line 67 of file subr_param.c.

Referenced by init_param1().

#define MAXFILES   (maxproc * 2)

Definition at line 79 of file subr_param.c.

Referenced by init_param2().

#define NBUF   0

Definition at line 76 of file subr_param.c.

Referenced by init_param2().

#define NPROC   (20 + 16 * maxusers)

Definition at line 74 of file subr_param.c.

Referenced by init_param2().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static enum VM_GUEST detect_virtual ( void  )
static

Definition at line 185 of file subr_param.c.

References freeenv(), getenv(), vm_bnames, and vm_pnames.

Referenced by init_param1().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_param1 ( void  )

Definition at line 216 of file subr_param.c.

References detect_virtual(), dfldsiz, dflssiz, HZ, hz, HZ_VM, maxbcache, maxdsiz, maxssiz, maxswzone, maxtsiz, msgbufsize, ngroups_max, pid_max, sgrowsiz, tick, and vm_guest.

Here is the call graph for this function:

void init_param2 ( long  physpages)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
hz  ,
CTLFLAG_RDTUN  ,
hz,
,
"Number of clock ticks per second"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
ncallout  ,
CTLFLAG_RDTUN  ,
ncallout,
,
"Number of pre-allocated timer events"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nbuf  ,
CTLFLAG_RDTUN  ,
nbuf,
,
"Number of buffers in the buffer cache"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nswbuf  ,
CTLFLAG_RDTUN  ,
nswbuf,
,
"Number of swap buffers"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
msgbufsize  ,
CTLFLAG_RDTUN  ,
msgbufsize,
,
"Size of the kernel message buffer"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
bio_transient_maxcnt  ,
CTLFLAG_RDTUN  ,
bio_transient_maxcnt,
,
"Maximum number of transient BIOs mappings"   
)
static int sysctl_kern_vm_guest ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 358 of file subr_param.c.

References vm_guest, and vm_guest_sysctl_names.

SYSCTL_LONG ( _kern  ,
OID_AUTO  ,
maxswzone  ,
CTLFLAG_RDTUN  ,
maxswzone,
,
"Maximum memory for swap metadata"   
)
SYSCTL_LONG ( _kern  ,
OID_AUTO  ,
maxbcache  ,
CTLFLAG_RDTUN  ,
maxbcache,
,
"Maximum value of vfs.maxbufspace  
)
SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
vm_guest  ,
CTLFLAG_RD|  CTLTYPE_STRING,
NULL  ,
,
sysctl_kern_vm_guest  ,
"A"  ,
"Virtual machine guest detected? (none|generic|xen)"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxtsiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
maxtsiz,
,
"Maximum text size"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
dfldsiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
dfldsiz,
,
"Initial data size limit"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxdsiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
maxdsiz,
,
"Maximum data size"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
dflssiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
dflssiz,
,
"Initial stack size limit"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
maxssiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
maxssiz,
,
"Maximum stack size"   
)
SYSCTL_ULONG ( _kern  ,
OID_AUTO  ,
sgrowsiz  ,
CTLFLAG_RW|  CTLFLAG_TUN,
sgrowsiz,
,
"Amount to grow stack on a stack fault"   
)

Variable Documentation

int bio_transient_maxcnt

Definition at line 94 of file subr_param.c.

Referenced by init_param2(), and kern_vfs_bio_buffer_alloc().

u_long dfldsiz

Definition at line 103 of file subr_param.c.

Referenced by init_param1(), and proc0_init().

u_long dflssiz

Definition at line 105 of file subr_param.c.

Referenced by init_param1(), and proc0_init().

long maxbcache

Definition at line 99 of file subr_param.c.

Referenced by init_param1(), and kern_vfs_bio_buffer_alloc().

u_long maxdsiz

Definition at line 104 of file subr_param.c.

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

int maxfiles
int maxfilesperproc

Definition at line 90 of file subr_param.c.

Referenced by getmaxfd(), init_param2(), kern_proc_setrlimit(), sys_getdtablesize(), and sys_poll().

long maxpipekva

Definition at line 100 of file subr_param.c.

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

int maxproc

Definition at line 87 of file subr_param.c.

Referenced by fork1(), init_param2(), proc0_init(), procinit(), threadinit(), uihashinit(), and vntblinit().

int maxprocperuid

Definition at line 88 of file subr_param.c.

Referenced by init_param2(), and kern_proc_setrlimit().

u_long maxssiz

Definition at line 106 of file subr_param.c.

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

long maxswzone

Definition at line 98 of file subr_param.c.

Referenced by init_param1().

u_long maxtsiz

Definition at line 102 of file subr_param.c.

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

int maxusers

Definition at line 86 of file subr_param.c.

Referenced by init_param2().

int msgbufsize

Definition at line 91 of file subr_param.c.

Referenced by init_param1().

int ncallout
int ngroups_max

Definition at line 95 of file subr_param.c.

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

int nswbuf

Definition at line 96 of file subr_param.c.

Referenced by kern_vfs_bio_buffer_alloc().

pid_t pid_max = PID_MAX

Definition at line 97 of file subr_param.c.

Referenced by fork_findpid(), init_param1(), sysctl_kern_pid_max(), and sysctl_kern_randompid().

u_long sgrowsiz

Definition at line 107 of file subr_param.c.

Referenced by exec_new_vmspace(), and init_param1().

struct buf* swbuf

Definition at line 147 of file subr_param.c.

Referenced by kern_vfs_bio_buffer_alloc().

const char* const vm_bnames[]
static
Initial value:
= {
"QEMU",
"Plex86",
"Bochs",
"Xen",
"BHYVE",
"Seabios",
NULL
}

Definition at line 161 of file subr_param.c.

Referenced by detect_virtual().

int vm_guest

Definition at line 101 of file subr_param.c.

Referenced by init_param1(), and sysctl_kern_vm_guest().

const char* const vm_guest_sysctl_names[]
static
Initial value:
= {
"none",
"generic",
"xen",
NULL
}

Definition at line 153 of file subr_param.c.

Referenced by sysctl_kern_vm_guest().

const char* const vm_pnames[]
static
Initial value:
= {
"VMware Virtual Platform",
"Virtual Machine",
"VirtualBox",
"Parallels Virtual Platform",
"KVM",
NULL
}

Definition at line 171 of file subr_param.c.

Referenced by detect_virtual().