xref: /titanic_50/usr/src/uts/common/conf/param.c (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <sys/types.h>
29 #include <sys/time.h>
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/signal.h>
33 #include <sys/sysmacros.h>
34 #include <sys/cmn_err.h>
35 #include <sys/user.h>
36 #include <sys/proc.h>
37 #include <sys/task.h>
38 #include <sys/project.h>
39 #include <sys/klwp.h>
40 #include <sys/vnode.h>
41 #include <sys/file.h>
42 #include <sys/fcntl.h>
43 #include <sys/flock.h>
44 #include <sys/var.h>
45 #include <sys/stream.h>
46 #include <sys/strsubr.h>
47 #include <sys/conf.h>
48 #include <sys/class.h>
49 #include <sys/ts.h>
50 #include <sys/rt.h>
51 #include <sys/exec.h>
52 #include <sys/exechdr.h>
53 #include <sys/buf.h>
54 #include <sys/resource.h>
55 #include <vm/seg.h>
56 #include <vm/pvn.h>
57 #include <vm/seg_kmem.h>
58 #include <sys/vmparam.h>
59 #include <sys/machparam.h>
60 #include <sys/utsname.h>
61 #include <sys/kmem.h>
62 #include <sys/stack.h>
63 #include <sys/modctl.h>
64 #include <sys/fdbuffer.h>
65 #include <sys/cyclic_impl.h>
66 #include <sys/disp.h>
67 #include <sys/tuneable.h>
68 
69 #include <sys/vmem.h>
70 #include <sys/clock.h>
71 #include <sys/serializer.h>
72 
73 /*
74  * The following few lines describe generic things that must be compiled
75  * into the booted executable (unix) rather than genunix or any other
76  * module because they're required by crash dump readers, etc.
77  */
78 struct modctl modules;		/* head of linked list of modules */
79 char *default_path;		/* default module loading path */
80 struct swapinfo *swapinfo;	/* protected by the swapinfo_lock */
81 proc_t *practive;		/* active process list */
82 uint_t nproc;			/* current number of processes */
83 proc_t p0;			/* process 0 */
84 struct plock p0lock;		/* p0's p_lock */
85 klwp_t lwp0;			/* t0's lwp */
86 task_t *task0p;			/* task 0 */
87 kproject_t *proj0p;		/* location of project 0 */
88 
89 /*
90  * The following are "implementation architecture" dependent constants made
91  * available here in the form of initialized data for use by "implementation
92  * architecture" independent modules. See machparam.h.
93  */
94 const unsigned long	_pagesize	= (unsigned long)PAGESIZE;
95 const unsigned int	_pageshift	= (unsigned int)PAGESHIFT;
96 const unsigned long	_pageoffset	= (unsigned long)PAGEOFFSET;
97 /*
98  * XXX - This value pagemask has to be a 64bit size because
99  * large file support uses this mask on offsets which are 64 bit size.
100  * using unsigned leaves the higher 32 bits value as zero thus
101  * corrupting offset calculations in the file system and VM.
102  */
103 const u_longlong_t	_pagemask	= (u_longlong_t)PAGEMASK;
104 const unsigned long	_mmu_pagesize	= (unsigned long)MMU_PAGESIZE;
105 const unsigned int	_mmu_pageshift	= (unsigned int)MMU_PAGESHIFT;
106 const unsigned long	_mmu_pageoffset	= (unsigned long)MMU_PAGEOFFSET;
107 const unsigned long	_mmu_pagemask	= (unsigned long)MMU_PAGEMASK;
108 uintptr_t		_kernelbase	= (uintptr_t)KERNELBASE;
109 uintptr_t		_userlimit	= (uintptr_t)USERLIMIT;
110 uintptr_t		_userlimit32	= (uintptr_t)USERLIMIT32;
111 const uintptr_t		_argsbase	= (uintptr_t)ARGSBASE;
112 const unsigned int	_diskrpm	= (unsigned int)DISKRPM;
113 const unsigned long	_pgthresh	= (unsigned long)PGTHRESH;
114 const unsigned int	_maxslp		= (unsigned int)MAXSLP;
115 const unsigned long	_maxhandspreadpages = (unsigned long)MAXHANDSPREADPAGES;
116 const int		_ncpu 		= (int)NCPU;
117 const unsigned long	_defaultstksz	= (unsigned long)DEFAULTSTKSZ;
118 const unsigned int	_nbpg		= (unsigned int)MMU_PAGESIZE;
119 
120 /*
121  * System parameter formulae.
122  *
123  * This file is copied into each directory where we compile
124  * the kernel; it should be modified there to suit local taste
125  * if necessary.
126  */
127 
128 /*
129  * Default hz is 100, but if we set hires_tick we get higher resolution
130  * clock behavior (currently defined to be 1000 hz).  Higher values seem
131  * to work, but are not supported.
132  *
133  * If we do decide to play with higher values, remember that hz should
134  * satisfy the following constraints to avoid integer round-off problems:
135  *
136  * (1) hz should be in the range 100 <= hz <= MICROSEC.  If hz exceeds
137  *     MICROSEC, usec_per_tick will be zero and lots of stuff will break.
138  *     Similarly, if hz < 100 then hz / 100 == 0 and stuff will break.
139  *
140  * (2) If hz <= 1000, it should be both a multiple of 100 and a
141  *	divisor of 1000.
142  *
143  * (3) If hz > 1000, it should be both a multiple of 1000 and a
144  *	divisor of MICROSEC.
145  *
146  * Thus the only reasonable values of hz (i.e. the values that won't
147  * cause roundoff error) are: 100, 200, 500, 1000, 2000, 4000, 5000,
148  * 8000, 10000, 20000, 25000, 40000, 50000, 100000, 125000, 200000,
149  * 250000, 500000, 1000000.  As of this writing (1996) a clock rate
150  * of more than about 10 kHz seems utterly ridiculous, although
151  * this observation will no doubt seem quaintly amusing one day.
152  */
153 int hz = 100;
154 int hires_hz = 1000;
155 int hires_tick = 0;
156 int cpu_decay_factor = 10;	/* this is no longer tied to clock */
157 int tick_per_msec;	/* clock ticks per millisecond (zero if hz < 1000) */
158 int msec_per_tick;	/* millseconds per clock tick (zero if hz > 1000) */
159 int usec_per_tick;	/* microseconds per clock tick */
160 int nsec_per_tick;	/* nanoseconds per clock tick */
161 int max_hres_adj;	/* maximum adjustment of hrtime per tick */
162 
163 /*
164  * Setting "snooping" to a non-zero value will cause a deadman panic if
165  * snoop_interval microseconds elapse without lbolt increasing.  The default
166  * snoop_interval is 50 seconds.
167  */
168 #define	SNOOP_INTERVAL_MIN	(MICROSEC)
169 #define	SNOOP_INTERVAL_DEFAULT	(50 * MICROSEC)
170 
171 int snooping = 0;
172 uint_t snoop_interval = SNOOP_INTERVAL_DEFAULT;
173 
174 /*
175  * Tables of initialization functions, called from main().
176  */
177 
178 extern void system_taskq_init(void);
179 extern void binit(void);
180 extern void space_init(void);
181 extern void dnlc_init(void);
182 extern void vfsinit(void);
183 extern void finit(void);
184 extern void strinit(void);
185 extern void flk_init(void);
186 extern void ftrace_init(void);
187 extern void softcall_init(void);
188 extern void ttyinit(void);
189 extern void schedctl_init(void);
190 extern void deadman_init(void);
191 extern void clock_timer_init(void);
192 extern void clock_realtime_init(void);
193 extern void clock_highres_init(void);
194 
195 void	(*init_tbl[])(void) = {
196 	system_taskq_init,
197 	binit,
198 	space_init,
199 	dnlc_init,
200 	vfsinit,
201 	finit,
202 	strinit,
203 	serializer_init,
204 	softcall_init,
205 	ttyinit,
206 	as_init,
207 	pvn_init,
208 	anon_init,
209 	segvn_init,
210 	flk_init,
211 	schedctl_init,
212 	fdb_init,
213 	deadman_init,
214 	clock_timer_init,
215 	clock_realtime_init,
216 	clock_highres_init,
217 	0
218 };
219 
220 
221 /*
222  * Any per cpu resources should be initialized via
223  * an entry in mp_init_tbl().
224  */
225 
226 void	(*mp_init_tbl[])(void) = {
227 	ftrace_init,
228 	cyclic_mp_init,
229 	0
230 };
231 
232 int maxusers;		/* kitchen-sink knob for dynamic configuration */
233 
234 /*
235  * pidmax -- highest pid value assigned by the system
236  * Settable in /etc/system
237  */
238 int pidmax = DEFAULT_MAXPID;
239 
240 /*
241  * jump_pid - if set, this value is where pid numbers should start
242  * after the first few system pids (0-3) are used.  If 0, pids are
243  * chosen in the usual way. This variable can be used to quickly
244  * create large pids (by setting it to 100000, for example). pids
245  * less than this value will never be chosen.
246  */
247 pid_t jump_pid = DEFAULT_JUMPPID;
248 
249 /*
250  * autoup -- used in struct var for dynamic config of the age a delayed-write
251  * buffer must be in seconds before bdflush will write it out.
252  */
253 #define	DEFAULT_AUTOUP	30
254 int autoup = DEFAULT_AUTOUP;
255 
256 /*
257  * bufhwm -- tuneable variable for struct var for v_bufhwm.
258  * high water mark for buffer cache mem usage in units of K bytes.
259  *
260  * bufhwm_pct -- ditto, but given in % of physmem.
261  */
262 int bufhwm = 0;
263 int bufhwm_pct = 0;
264 
265 /*
266  * Process table.
267  */
268 int maxpid;
269 int max_nprocs;		/* set in param_init() */
270 int maxuprc;		/* set in param_init() */
271 int reserved_procs;
272 int nthread = 1;
273 
274 /*
275  * UFS tunables
276  */
277 int ufs_ninode;		/* declared here due to backwards compatibility */
278 int ndquot;		/* declared here due to backwards compatibility */
279 
280 /*
281  * Exec switch table. This is used by the generic exec module
282  * to switch out to the desired executable type, based on the
283  * magic number. The currently supported types are ELF, a.out
284  * (both NMAGIC and ZMAGIC), interpreter (#!) files,
285  * and Java executables.
286  */
287 /*
288  * Magic numbers
289  */
290 short elfmagic = 0x7f45;
291 short intpmagic = 0x2321;
292 short jmagic = 0x504b;
293 
294 #if defined(__sparc)
295 short aout_nmagic = NMAGIC;
296 short aout_zmagic = ZMAGIC;
297 short aout_omagic = OMAGIC;
298 #endif
299 short nomagic = 0;
300 
301 /*
302  * Magic strings
303  */
304 #define	ELF32MAGIC_STRING	"\x7f""ELF\x1"
305 #define	ELF64MAGIC_STRING	"\x7f""ELF\x2"
306 #define	INTPMAGIC_STRING	"#!"
307 #define	JAVAMAGIC_STRING	"PK\003\004"
308 #define	AOUT_OMAGIC_STRING	"\x1""\x07"	/* 0407 */
309 #define	AOUT_NMAGIC_STRING	"\x1""\x08"	/* 0410 */
310 #define	AOUT_ZMAGIC_STRING	"\x1""\x0b"	/* 0413 */
311 #define	NOMAGIC_STRING		""
312 
313 char elf32magicstr[] = ELF32MAGIC_STRING;
314 char elf64magicstr[] = ELF64MAGIC_STRING;
315 char intpmagicstr[] = INTPMAGIC_STRING;
316 char javamagicstr[] = JAVAMAGIC_STRING;
317 #if defined(__sparc)
318 char aout_nmagicstr[] = AOUT_NMAGIC_STRING;
319 char aout_zmagicstr[] = AOUT_ZMAGIC_STRING;
320 char aout_omagicstr[] = AOUT_OMAGIC_STRING;
321 #endif
322 char nomagicstr[] = NOMAGIC_STRING;
323 
324 char *execswnames[] = {
325 	"elfexec",	/* Elf32 */
326 #ifdef _LP64
327 	"elfexec",	/* Elf64 */
328 #endif
329 	"intpexec",
330 	"javaexec",
331 #if defined(__sparc)
332 	"aoutexec",
333 	"aoutexec",
334 	"aoutexec",
335 #endif
336 	NULL,
337 	NULL,
338 	NULL
339 };
340 
341 struct execsw execsw[] = {
342 	{ elf32magicstr, 0, 5, NULL, NULL, NULL },
343 #ifdef _LP64
344 	{ elf64magicstr, 0, 5, NULL, NULL, NULL },
345 #endif
346 	{ intpmagicstr, 0, 2, NULL, NULL, NULL },
347 	{ javamagicstr, 0, 4, NULL, NULL, NULL },
348 #if defined(__sparc)
349 	{ aout_zmagicstr, 2, 2, NULL, NULL, NULL },
350 	{ aout_nmagicstr, 2, 2, NULL, NULL, NULL },
351 	{ aout_omagicstr, 2, 2, NULL, NULL, NULL },
352 #endif
353 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
354 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
355 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
356 	{ nomagicstr, 0, 0, NULL, NULL, NULL }
357 };
358 int nexectype = sizeof (execsw) / sizeof (execsw[0]);	/* # of exec types */
359 kmutex_t execsw_lock;	/* Used for allocation of execsw entries */
360 
361 /*
362  * symbols added to make changing max-file-descriptors
363  * simple via /etc/system
364  */
365 #define	RLIM_FD_CUR 0x100
366 #define	RLIM_FD_MAX 0x10000
367 
368 uint_t rlim_fd_cur = RLIM_FD_CUR;
369 uint_t rlim_fd_max = RLIM_FD_MAX;
370 
371 /*
372  * (Default resource limits were formerly declared here, but are now provided by
373  * the more general resource controls framework.)
374  */
375 
376 /*
377  * STREAMS tunables
378  */
379 int	nstrpush = 9;		/* maximum # of modules/drivers on a stream */
380 ssize_t	strctlsz = 1024;	/* maximum size of user-generated M_PROTO */
381 ssize_t	strmsgsz = 0x10000;	/* maximum size of user-generated M_DATA */
382 				/* for `strmsgsz', zero means unlimited */
383 /*
384  * Filesystem tunables
385  */
386 int	rstchown = 1;		/* POSIX_CHOWN_RESTRICTED is enabled */
387 int	ngroups_max = NGROUPS_MAX_DEFAULT;
388 
389 /*
390  * generic scheduling stuff
391  *
392  * Configurable parameters for RT and TS are in the respective
393  * scheduling class modules.
394  */
395 
396 pri_t maxclsyspri = MAXCLSYSPRI;
397 pri_t minclsyspri = MINCLSYSPRI;
398 char sys_name[] = "SYS";
399 
400 extern pri_t sys_init();
401 extern classfuncs_t sys_classfuncs;
402 
403 sclass_t sclass[] = {
404 	{ "SYS",	sys_init,	&sys_classfuncs, STATIC_SCHED, 0 },
405 	{ "",	NULL,	NULL,	NULL, 0 },
406 	{ "",	NULL,	NULL,	NULL, 0 },
407 	{ "",	NULL,	NULL,	NULL, 0 },
408 	{ "",	NULL,	NULL,	NULL, 0 },
409 	{ "",	NULL,	NULL,	NULL, 0 },
410 	{ "",	NULL,	NULL,	NULL, 0 },
411 	{ "",	NULL,	NULL,	NULL, 0 },
412 	{ "",	NULL,	NULL,	NULL, 0 },
413 	{ "",	NULL,	NULL,	NULL, 0 }
414 };
415 
416 int loaded_classes = 1;		/* for loaded classes */
417 kmutex_t class_lock;		/* lock for class[] */
418 
419 int nclass = sizeof (sclass) / sizeof (sclass_t);
420 char initcls[] = "TS";
421 char *defaultclass = initcls;
422 
423 /*
424  * Tunable system parameters.
425  */
426 
427 /*
428  * The integers tune_* are done this way so that the tune
429  * data structure may be "tuned" if necessary from the /etc/system
430  * file. The tune data structure is initialized in param_init();
431  */
432 
433 tune_t tune;
434 
435 /*
436  * If freemem < t_getpgslow, then start to steal pages from processes.
437  */
438 int tune_t_gpgslo = 25;
439 
440 /*
441  * Rate at which fsflush is run, in seconds.
442  */
443 #define	DEFAULT_TUNE_T_FSFLUSHR	1
444 int tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
445 
446 /*
447  * The minimum available resident (not swappable) memory to maintain
448  * in order to avoid deadlock.  In pages.
449  */
450 int tune_t_minarmem = 25;
451 
452 /*
453  * The minimum available swappable memory to maintain in order to avoid
454  * deadlock.  In pages.
455  */
456 int tune_t_minasmem = 25;
457 
458 int tune_t_flckrec = 512;	/* max # of active frlocks */
459 
460 /*
461  * Number of currently available pages that cannot be 'locked'
462  * This is set in init_pages_pp_maximum, and must be initialized
463  * to zero here to detect an override in /etc/system
464  */
465 pgcnt_t pages_pp_maximum = 0;
466 
467 int boothowto;			/* boot flags passed to kernel */
468 struct var v;			/* System Configuration Information */
469 
470 /*
471  * System Configuration Information
472  */
473 
474 #if defined(__sparc)
475 
476 /*
477  * On sparc machines, read hw_serial from the firmware at boot time
478  * and simply assert Sun is the hardware provider.  Hmm.
479  */
480 char architecture[] = "sparcv9";
481 char architecture_32[] = "sparc";
482 char hw_serial[11];
483 char hw_provider[] = "Sun_Microsystems";
484 
485 #elif defined(__i386)
486 
487 /*
488  * On x86 machines, read hw_serial, hw_provider and srpc_domain from
489  * /etc/bootrc at boot time.
490  */
491 char architecture[] = "i386";
492 char architecture_32[] = "i386";
493 char hw_serial[11] = "0";
494 char hw_provider[SYS_NMLN] = "";
495 
496 #elif defined(__amd64)
497 
498 /*
499  * On amd64 machines, read hw_serial, hw_provider and srpc_domain from
500  * /etc/bootrc at boot time.
501  */
502 char architecture[] = "amd64";
503 char architecture_32[] = "i386";
504 char hw_serial[11] = "0";
505 char hw_provider[SYS_NMLN] = "";
506 
507 #else
508 #error "unknown processor architecture"
509 #endif
510 
511 char srpc_domain[SYS_NMLN] = "";
512 char platform[SYS_NMLN] = "";	/* read from the devinfo root node */
513 
514 /* Initialize isa_list */
515 char *isa_list = architecture;
516 
517 static pgcnt_t original_physmem = 0;
518 
519 #define	MIN_DEFAULT_MAXUSERS	8u
520 #define	MAX_DEFAULT_MAXUSERS	2048u
521 #define	MAX_MAXUSERS		4096u
522 
523 void
524 param_preset(void)
525 {
526 	original_physmem = physmem;
527 }
528 
529 void
530 param_calc(int platform_max_nprocs)
531 {
532 	/*
533 	 * Default to about one "user" per megabyte, taking into
534 	 * account both physical and virtual constraints.
535 	 * Note: 2^20 is a meg; shifting right by (20 - PAGESHIFT)
536 	 * converts pages to megs without integer overflow.
537 	 */
538 #if defined(__sparc)
539 	if (physmem > original_physmem) {
540 		physmem = original_physmem;
541 		cmn_err(CE_NOTE, "physmem limited to %ld", physmem);
542 	}
543 #else
544 	if (physmem != original_physmem) {
545 		cmn_err(CE_NOTE, "physmem cannot be modified to 0x%lx"
546 		    " via /etc/system. Please use eeprom(1M) instead.",
547 		    physmem);
548 		physmem = original_physmem;
549 	}
550 #endif
551 	if (maxusers == 0) {
552 		pgcnt_t physmegs = physmem >> (20 - PAGESHIFT);
553 		pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20;
554 		maxusers = MIN(MAX(MIN(physmegs, virtmegs),
555 		    MIN_DEFAULT_MAXUSERS), MAX_DEFAULT_MAXUSERS);
556 	}
557 	if (maxusers > MAX_MAXUSERS) {
558 		maxusers = MAX_MAXUSERS;
559 		cmn_err(CE_NOTE, "maxusers limited to %d", MAX_MAXUSERS);
560 	}
561 
562 	if (ngroups_max > NGROUPS_MAX_DEFAULT)
563 		cmn_err(CE_WARN,
564 		"ngroups_max of %d > 16, NFS AUTH_SYS will not work properly",
565 			ngroups_max);
566 
567 #ifdef DEBUG
568 	/*
569 	 * The purpose of maxusers is to prevent memory overcommit.
570 	 * DEBUG kernels take more space, so reduce maxusers a bit.
571 	 */
572 	maxusers = (3 * maxusers) / 4;
573 #endif
574 
575 	/*
576 	 * We need to dynamically change any variables now so that
577 	 * the setting of maxusers and pidmax propagate to the other
578 	 * variables that are dependent on them.
579 	 */
580 	if (reserved_procs == 0)
581 		reserved_procs = 5;
582 	if (pidmax < reserved_procs || pidmax > MAX_MAXPID)
583 		maxpid = MAX_MAXPID;
584 	else
585 		maxpid = pidmax;
586 
587 	/*
588 	 * This allows platform-dependent code to constrain the maximum
589 	 * number of processes allowed in case there are e.g. VM limitations
590 	 * with how many contexts are available.
591 	 */
592 	if (max_nprocs == 0)
593 		max_nprocs = (10 + 16 * maxusers);
594 	if (platform_max_nprocs > 0 && max_nprocs > platform_max_nprocs)
595 		max_nprocs = platform_max_nprocs;
596 	if (max_nprocs > maxpid)
597 		max_nprocs = maxpid;
598 
599 	if (maxuprc == 0)
600 		maxuprc = (max_nprocs - reserved_procs);
601 }
602 
603 void
604 param_init(void)
605 {
606 	/*
607 	 * Set each individual element of struct var v to be the
608 	 * default value. This is done this way
609 	 * so that a user can set the assigned integer value in the
610 	 * /etc/system file *IF* tuning is needed.
611 	 */
612 	v.v_proc = max_nprocs;	/* v_proc - max # of processes system wide */
613 	v.v_maxupttl = max_nprocs - reserved_procs;
614 	v.v_maxsyspri = (int)maxclsyspri;  /* max global pri for sysclass */
615 	v.v_maxup = MIN(maxuprc, v.v_maxupttl); /* max procs per user */
616 	v.v_autoup = autoup;	/* v_autoup - delay for delayed writes */
617 
618 	/*
619 	 * Set each individual element of struct tune to be the
620 	 * default value. Each struct element This is done this way
621 	 *  so that a user can set the assigned integer value in the
622 	 * /etc/system file *IF* tuning is needed.
623 	 */
624 	tune.t_gpgslo = tune_t_gpgslo;
625 	tune.t_fsflushr = tune_t_fsflushr;
626 	tune.t_minarmem = tune_t_minarmem;
627 	tune.t_minasmem = tune_t_minasmem;
628 	tune.t_flckrec = tune_t_flckrec;
629 
630 	/*
631 	 * Initialization for file descriptors to correct mistaken settings in
632 	 * /etc/system.  Initialization of limits performed by resource control
633 	 * system.
634 	 */
635 	if (rlim_fd_cur > rlim_fd_max)
636 		rlim_fd_cur = rlim_fd_max;
637 
638 	/*
639 	 * calculations needed if hz was set in /etc/system
640 	 */
641 	if (hires_tick)
642 		hz = hires_hz;
643 
644 	tick_per_msec = hz / MILLISEC;
645 	msec_per_tick = MILLISEC / hz;
646 	usec_per_tick = MICROSEC / hz;
647 	nsec_per_tick = NANOSEC / hz;
648 	max_hres_adj = nsec_per_tick >> ADJ_SHIFT;
649 }
650 
651 /*
652  * Validate tuneable parameters following /etc/system processing,
653  * but prior to param_init().
654  */
655 void
656 param_check(void)
657 {
658 	if (ngroups_max < NGROUPS_UMIN || ngroups_max > NGROUPS_UMAX)
659 		ngroups_max = NGROUPS_MAX_DEFAULT;
660 
661 	if (autoup <= 0) {
662 		autoup = DEFAULT_AUTOUP;
663 		cmn_err(CE_WARN, "autoup <= 0; defaulting to %d", autoup);
664 	}
665 
666 	if (tune_t_fsflushr <= 0) {
667 		tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
668 		cmn_err(CE_WARN, "tune_t_fsflushr <= 0; defaulting to %d",
669 		    tune_t_fsflushr);
670 	}
671 
672 	if (jump_pid < 0 || jump_pid >= pidmax) {
673 		jump_pid = 0;
674 		cmn_err(CE_WARN, "jump_pid < 0 or >= pidmax; ignored");
675 	}
676 
677 	if (snoop_interval < SNOOP_INTERVAL_MIN) {
678 		snoop_interval = SNOOP_INTERVAL_DEFAULT;
679 		cmn_err(CE_WARN, "snoop_interval < minimum (%d); defaulting"
680 		    " to %d", SNOOP_INTERVAL_MIN, SNOOP_INTERVAL_DEFAULT);
681 	}
682 }
683