|
66 | 66 | * Redefined constants are from POSIX 1003.1 limits file.
|
67 | 67 | *
|
68 | 68 | * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
|
69 |
| - * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>) |
70 | 69 | */
|
71 | 70 | #include <sys/syslimits.h>
|
72 | 71 |
|
73 |
| -#define MAXCOMLEN 16 /* max command name remembered */ |
74 |
| -#define MAXINTERP 32 /* max interpreter file name length */ |
75 |
| -#define MAXLOGNAME 12 /* max login name length */ |
| 72 | +#define MAXCOMLEN 19 /* max command name remembered */ |
| 73 | +#define MAXINTERP PATH_MAX /* max interpreter file name length */ |
| 74 | +#define MAXLOGNAME 33 /* max login name length (incl. NUL) */ |
76 | 75 | #define MAXUPRC CHILD_MAX /* max simultaneous processes */
|
77 | 76 | #define NCARGS ARG_MAX /* max bytes for an exec function */
|
78 |
| -#define NGROUPS NGROUPS_MAX /* max number groups */ |
| 77 | +#define NGROUPS (NGROUPS_MAX+1) /* max number groups */ |
79 | 78 | #define NOFILE OPEN_MAX /* max open files per process */
|
80 | 79 | #define NOGROUP 65535 /* marker for empty group set member */
|
81 | 80 | #define MAXHOSTNAMELEN 256 /* max hostname size */
|
| 81 | +#define SPECNAMELEN 63 /* max length of devicename */ |
82 | 82 |
|
83 | 83 | /* More types and definitions used throughout the kernel. */
|
84 | 84 | #if defined(KERNEL) || defined(_KERNEL)
|
|
123 | 123 | /*
|
124 | 124 | * File system parameters and macros.
|
125 | 125 | *
|
126 |
| - * The file system is made out of blocks of at most MAXBSIZE units, with |
127 |
| - * smaller units (fragments) only in the last direct block. MAXBSIZE |
128 |
| - * primarily determines the size of buffers in the buffer pool. It may be |
129 |
| - * made larger without any effect on existing file systems; however making |
130 |
| - * it smaller make make some file systems unmountable. Also, MAXBSIZE |
131 |
| - * must be less than MAXPHYS!!! DFLTBSIZE is the average amount of |
132 |
| - * memory allocated by vfs_bio per nbuf. BKVASIZE is the average amount |
133 |
| - * of kernel virtual space allocated per nbuf. BKVASIZE should be >= |
134 |
| - * DFLTBSIZE. If it is significantly bigger than DFLTBSIZE, then |
135 |
| - * kva fragmentation causes fewer performance problems. |
| 126 | + * MAXBSIZE - Filesystems are made out of blocks of at most MAXBSIZE bytes |
| 127 | + * per block. MAXBSIZE may be made larger without effecting |
| 128 | + * any existing filesystems as long as it does not exceed MAXPHYS, |
| 129 | + * and may be made smaller at the risk of not being able to use |
| 130 | + * filesystems which require a block size exceeding MAXBSIZE. |
| 131 | + * |
| 132 | + * BKVASIZE - Nominal buffer space per buffer, in bytes. BKVASIZE is the |
| 133 | + * minimum KVM memory reservation the kernel is willing to make. |
| 134 | + * Filesystems can of course request smaller chunks. Actual |
| 135 | + * backing memory uses a chunk size of a page (PAGE_SIZE). |
| 136 | + * |
| 137 | + * If you make BKVASIZE too small you risk seriously fragmenting |
| 138 | + * the buffer KVM map which may slow things down a bit. If you |
| 139 | + * make it too big the kernel will not be able to optimally use |
| 140 | + * the KVM memory reserved for the buffer cache and will wind |
| 141 | + * up with too-few buffers. |
| 142 | + * |
| 143 | + * The default is 16384, roughly 2x the block size used by a |
| 144 | + * normal UFS filesystem. |
136 | 145 | */
|
137 |
| -#define MAXBSIZE 65536 |
138 |
| -#define BKVASIZE 8192 |
139 |
| -#define DFLTBSIZE 4096 |
140 |
| -#define MAXFRAG 8 |
| 146 | +#define MAXBSIZE 65536 /* must be power of 2 */ |
| 147 | +#define BKVASIZE 16384 /* must be power of 2 */ |
| 148 | +#define BKVAMASK (BKVASIZE-1) |
141 | 149 |
|
142 | 150 | /*
|
143 | 151 | * MAXPATHLEN defines the longest permissible path length after expanding
|
|
154 | 162 | #define MAXSYMLINKS 32
|
155 | 163 |
|
156 | 164 | /* Bit map related macros. */
|
157 |
| -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) |
158 |
| -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) |
159 |
| -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) |
160 |
| -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) |
| 165 | +#define setbit(a,i) (((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) |
| 166 | +#define clrbit(a,i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) |
| 167 | +#define isset(a,i) \ |
| 168 | + (((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) |
| 169 | +#define isclr(a,i) \ |
| 170 | + ((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) |
161 | 171 |
|
162 | 172 | /* Macros for counting and rounding. */
|
163 | 173 | #ifndef howmany
|
|
0 commit comments