#include <sys/param.h>
sys/param.h
macroBSD4_3
#define BSD4_3 1
macroBSD4_4
#define BSD4_4 1
macroPSWP
Priorities. Note that with 32 run queues, differences less than 4 are
insignificant.
#define PSWP 0
macroPVM
#define PVM 4
macroPINOD
#define PINOD 8
macroPRIBIO
#define PRIBIO 16
macroPVFS
#define PVFS 20
macroPSOCK
#define PSOCK 24
macroPWAIT
#define PWAIT 32
macroPLOCK
#define PLOCK 36
macroPPAUSE
#define PPAUSE 40
macroPUSER
#define PUSER 50
macroPRIMASK
#define PRIMASK 0x0ff
macroCLBYTES
Clustering of hardware pages on machines with ridiculously small
page sizes is done here. The paging subsystem deals with units of
CLSIZE pte's describing NBPG (from machine/param.h) pages each.
#define CLBYTES (CLSIZE*NBPG)
macroCLSHIFT
#define CLSHIFT (PGSHIFT+CLSIZELOG2)
macroclbase
#define clbase(i) (i)
macroclrnd
#define clrnd(i) (i)
macroMAXBSIZE
File system parameters and macros.
The file system is made out of blocks of at most MAXPHYS units, with
smaller units (fragments) only in the last direct block. MAXBSIZE
primarily determines the size of buffers in the buffer pool. It may be
made larger than MAXPHYS without any effect on existing file systems;
however making it smaller may make some file systems unmountable.
We set this to track the value of MAX_UPL_TRANSFER_BYTES from
osfmk/mach/memory_object_types.h to bound it at the maximum UPL size.
#define MAXBSIZE (256 * 4096)
macroMAXFRAG
#define MAXFRAG 8
macroMAXPHYSIO_WIRED
#define MAXPHYSIO_WIRED (16 * 1024 * 1024)
macroMAXPATHLEN
MAXPATHLEN defines the longest permissable path length after expanding
symbolic links. It is used to allocate a temporary buffer from the buffer
pool in which to do the name expansion, hence should be a power of two,
and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
maximum number of symbolic links that may be expanded in a path name.
It should be set high enough to allow all legitimate uses, but halt
infinite loops reasonably quickly.
#define MAXPATHLEN PATH_MAX
macroMAXSYMLINKS
#define MAXSYMLINKS 32
macrosetbit
Bit map related macros.
#define setbit(a, i) (((unsigned char *)(a))[(i)/NBBY] |= 1u<<((i)%NBBY))
macroroundup
Macros for counting, rounding.
#define roundup(x, y) ((((x) % (y)) == 0) ? (x) : ((x) + ((y) - ((x) % (y)))))
macropowerof2
#define powerof2(x) ((((x)-1)&(x))==0)
macroMAX
#define MAX(a, b) (((a)>(b))?(a):(b))
macroFSHIFT
Scale factor for scaled integers used to count %cpu time and load avgs.
The number of CPU `tick's that map to a unique `%age' can be expressed
by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
can be calculated (assuming 32 bits) can be closely approximated using
the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
#define FSHIFT 11
bits to right of fixed binary point