xref: /onnv-gate/usr/src/uts/common/conf/param.c (revision 13038:5279d6e2ec9e)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52958Sdr146992  * Common Development and Distribution License (the "License").
62958Sdr146992  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
2212173SMichael.Corcoran@Sun.COM  * Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #include <sys/types.h>
260Sstevel@tonic-gate #include <sys/time.h>
270Sstevel@tonic-gate #include <sys/param.h>
280Sstevel@tonic-gate #include <sys/systm.h>
290Sstevel@tonic-gate #include <sys/signal.h>
300Sstevel@tonic-gate #include <sys/sysmacros.h>
310Sstevel@tonic-gate #include <sys/cmn_err.h>
320Sstevel@tonic-gate #include <sys/user.h>
330Sstevel@tonic-gate #include <sys/proc.h>
340Sstevel@tonic-gate #include <sys/task.h>
350Sstevel@tonic-gate #include <sys/project.h>
360Sstevel@tonic-gate #include <sys/klwp.h>
370Sstevel@tonic-gate #include <sys/vnode.h>
380Sstevel@tonic-gate #include <sys/file.h>
390Sstevel@tonic-gate #include <sys/fcntl.h>
400Sstevel@tonic-gate #include <sys/flock.h>
410Sstevel@tonic-gate #include <sys/var.h>
420Sstevel@tonic-gate #include <sys/stream.h>
430Sstevel@tonic-gate #include <sys/strsubr.h>
440Sstevel@tonic-gate #include <sys/conf.h>
450Sstevel@tonic-gate #include <sys/class.h>
460Sstevel@tonic-gate #include <sys/ts.h>
470Sstevel@tonic-gate #include <sys/rt.h>
480Sstevel@tonic-gate #include <sys/exec.h>
490Sstevel@tonic-gate #include <sys/exechdr.h>
500Sstevel@tonic-gate #include <sys/buf.h>
510Sstevel@tonic-gate #include <sys/resource.h>
520Sstevel@tonic-gate #include <vm/seg.h>
530Sstevel@tonic-gate #include <vm/pvn.h>
540Sstevel@tonic-gate #include <vm/seg_kmem.h>
550Sstevel@tonic-gate #include <sys/vmparam.h>
560Sstevel@tonic-gate #include <sys/machparam.h>
570Sstevel@tonic-gate #include <sys/utsname.h>
580Sstevel@tonic-gate #include <sys/kmem.h>
590Sstevel@tonic-gate #include <sys/stack.h>
600Sstevel@tonic-gate #include <sys/modctl.h>
610Sstevel@tonic-gate #include <sys/fdbuffer.h>
620Sstevel@tonic-gate #include <sys/cyclic_impl.h>
630Sstevel@tonic-gate #include <sys/disp.h>
640Sstevel@tonic-gate #include <sys/tuneable.h>
658662SJordan.Vaughan@Sun.com #include <sys/systeminfo.h>
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #include <sys/vmem.h>
680Sstevel@tonic-gate #include <sys/clock.h>
6911066Srafael.vanoni@sun.com #include <sys/clock_impl.h>
700Sstevel@tonic-gate #include <sys/serializer.h>
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /*
730Sstevel@tonic-gate  * The following few lines describe generic things that must be compiled
740Sstevel@tonic-gate  * into the booted executable (unix) rather than genunix or any other
750Sstevel@tonic-gate  * module because they're required by crash dump readers, etc.
760Sstevel@tonic-gate  */
770Sstevel@tonic-gate struct modctl modules;		/* head of linked list of modules */
780Sstevel@tonic-gate char *default_path;		/* default module loading path */
790Sstevel@tonic-gate struct swapinfo *swapinfo;	/* protected by the swapinfo_lock */
800Sstevel@tonic-gate proc_t *practive;		/* active process list */
810Sstevel@tonic-gate uint_t nproc;			/* current number of processes */
820Sstevel@tonic-gate proc_t p0;			/* process 0 */
830Sstevel@tonic-gate struct plock p0lock;		/* p0's p_lock */
840Sstevel@tonic-gate klwp_t lwp0;			/* t0's lwp */
850Sstevel@tonic-gate task_t *task0p;			/* task 0 */
860Sstevel@tonic-gate kproject_t *proj0p;		/* location of project 0 */
870Sstevel@tonic-gate 
880Sstevel@tonic-gate /*
890Sstevel@tonic-gate  * The following are "implementation architecture" dependent constants made
900Sstevel@tonic-gate  * available here in the form of initialized data for use by "implementation
910Sstevel@tonic-gate  * architecture" independent modules. See machparam.h.
920Sstevel@tonic-gate  */
930Sstevel@tonic-gate const unsigned long	_pagesize	= (unsigned long)PAGESIZE;
940Sstevel@tonic-gate const unsigned int	_pageshift	= (unsigned int)PAGESHIFT;
950Sstevel@tonic-gate const unsigned long	_pageoffset	= (unsigned long)PAGEOFFSET;
960Sstevel@tonic-gate /*
970Sstevel@tonic-gate  * XXX - This value pagemask has to be a 64bit size because
980Sstevel@tonic-gate  * large file support uses this mask on offsets which are 64 bit size.
990Sstevel@tonic-gate  * using unsigned leaves the higher 32 bits value as zero thus
1000Sstevel@tonic-gate  * corrupting offset calculations in the file system and VM.
1010Sstevel@tonic-gate  */
1020Sstevel@tonic-gate const u_longlong_t	_pagemask	= (u_longlong_t)PAGEMASK;
1030Sstevel@tonic-gate const unsigned long	_mmu_pagesize	= (unsigned long)MMU_PAGESIZE;
1040Sstevel@tonic-gate const unsigned int	_mmu_pageshift	= (unsigned int)MMU_PAGESHIFT;
1050Sstevel@tonic-gate const unsigned long	_mmu_pageoffset	= (unsigned long)MMU_PAGEOFFSET;
1060Sstevel@tonic-gate const unsigned long	_mmu_pagemask	= (unsigned long)MMU_PAGEMASK;
1070Sstevel@tonic-gate uintptr_t		_kernelbase	= (uintptr_t)KERNELBASE;
1080Sstevel@tonic-gate uintptr_t		_userlimit	= (uintptr_t)USERLIMIT;
1090Sstevel@tonic-gate uintptr_t		_userlimit32	= (uintptr_t)USERLIMIT32;
1100Sstevel@tonic-gate const uintptr_t		_argsbase	= (uintptr_t)ARGSBASE;
1110Sstevel@tonic-gate const unsigned int	_diskrpm	= (unsigned int)DISKRPM;
1120Sstevel@tonic-gate const unsigned long	_pgthresh	= (unsigned long)PGTHRESH;
1130Sstevel@tonic-gate const unsigned int	_maxslp		= (unsigned int)MAXSLP;
1140Sstevel@tonic-gate const unsigned long	_maxhandspreadpages = (unsigned long)MAXHANDSPREADPAGES;
1150Sstevel@tonic-gate const int		_ncpu 		= (int)NCPU;
11612173SMichael.Corcoran@Sun.COM const int		_ncpu_log2	= (int)NCPU_LOG2;
11712230SFrank.Rival@oracle.com const int		_ncpu_p2	= (int)NCPU_P2;
1180Sstevel@tonic-gate const unsigned long	_defaultstksz	= (unsigned long)DEFAULTSTKSZ;
1190Sstevel@tonic-gate const unsigned int	_nbpg		= (unsigned int)MMU_PAGESIZE;
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * System parameter formulae.
1230Sstevel@tonic-gate  *
1240Sstevel@tonic-gate  * This file is copied into each directory where we compile
1250Sstevel@tonic-gate  * the kernel; it should be modified there to suit local taste
1260Sstevel@tonic-gate  * if necessary.
1270Sstevel@tonic-gate  */
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate /*
1300Sstevel@tonic-gate  * Default hz is 100, but if we set hires_tick we get higher resolution
1310Sstevel@tonic-gate  * clock behavior (currently defined to be 1000 hz).  Higher values seem
1320Sstevel@tonic-gate  * to work, but are not supported.
1330Sstevel@tonic-gate  *
1340Sstevel@tonic-gate  * If we do decide to play with higher values, remember that hz should
1350Sstevel@tonic-gate  * satisfy the following constraints to avoid integer round-off problems:
1360Sstevel@tonic-gate  *
1370Sstevel@tonic-gate  * (1) hz should be in the range 100 <= hz <= MICROSEC.  If hz exceeds
1380Sstevel@tonic-gate  *     MICROSEC, usec_per_tick will be zero and lots of stuff will break.
1390Sstevel@tonic-gate  *     Similarly, if hz < 100 then hz / 100 == 0 and stuff will break.
1400Sstevel@tonic-gate  *
1410Sstevel@tonic-gate  * (2) If hz <= 1000, it should be both a multiple of 100 and a
1420Sstevel@tonic-gate  *	divisor of 1000.
1430Sstevel@tonic-gate  *
1440Sstevel@tonic-gate  * (3) If hz > 1000, it should be both a multiple of 1000 and a
1450Sstevel@tonic-gate  *	divisor of MICROSEC.
1460Sstevel@tonic-gate  *
1470Sstevel@tonic-gate  * Thus the only reasonable values of hz (i.e. the values that won't
1480Sstevel@tonic-gate  * cause roundoff error) are: 100, 200, 500, 1000, 2000, 4000, 5000,
1490Sstevel@tonic-gate  * 8000, 10000, 20000, 25000, 40000, 50000, 100000, 125000, 200000,
1500Sstevel@tonic-gate  * 250000, 500000, 1000000.  As of this writing (1996) a clock rate
1510Sstevel@tonic-gate  * of more than about 10 kHz seems utterly ridiculous, although
1520Sstevel@tonic-gate  * this observation will no doubt seem quaintly amusing one day.
1530Sstevel@tonic-gate  */
15411066Srafael.vanoni@sun.com #define	HIRES_HZ_DEFAULT	1000
15511066Srafael.vanoni@sun.com 
15611066Srafael.vanoni@sun.com int hz = HZ_DEFAULT;
15711066Srafael.vanoni@sun.com int hires_hz = HIRES_HZ_DEFAULT;
15811066Srafael.vanoni@sun.com 
1590Sstevel@tonic-gate int hires_tick = 0;
1600Sstevel@tonic-gate int cpu_decay_factor = 10;	/* this is no longer tied to clock */
16111066Srafael.vanoni@sun.com int max_hres_adj;	/* maximum adjustment of hrtime per tick */
1620Sstevel@tonic-gate int tick_per_msec;	/* clock ticks per millisecond (zero if hz < 1000) */
16311066Srafael.vanoni@sun.com 
16411066Srafael.vanoni@sun.com /*
16511066Srafael.vanoni@sun.com  * Milliseconds, Microseconds, and Nanoseconds per clock tick
16611066Srafael.vanoni@sun.com  *
16711066Srafael.vanoni@sun.com  * Note:
16811066Srafael.vanoni@sun.com  *  msec_per_tick is zero if hz > 1000
16911066Srafael.vanoni@sun.com  */
17011066Srafael.vanoni@sun.com int msec_per_tick;
17111066Srafael.vanoni@sun.com int usec_per_tick;
17211066Srafael.vanoni@sun.com int nsec_per_tick;
17311066Srafael.vanoni@sun.com 
17411066Srafael.vanoni@sun.com /*
17511066Srafael.vanoni@sun.com  * Time Resolution values. These are defined in condvar.h and initialized in
17611066Srafael.vanoni@sun.com  * param_init(). Consumers of cv_reltimedwait() and cv_reltimedwait_sig()
17711066Srafael.vanoni@sun.com  * need to specify how accurate the timeout argument should be through
17811066Srafael.vanoni@sun.com  * one of these values. The intention is to allow the underlying implementation
17911066Srafael.vanoni@sun.com  * to anticipate or defer the expiration of timeouts, preventing unnecessary
18011066Srafael.vanoni@sun.com  * wakeups by batch processing similarly expiring events.
18111066Srafael.vanoni@sun.com  */
18211066Srafael.vanoni@sun.com time_res_t time_res[TR_COUNT];
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate /*
1850Sstevel@tonic-gate  * Setting "snooping" to a non-zero value will cause a deadman panic if
1860Sstevel@tonic-gate  * snoop_interval microseconds elapse without lbolt increasing.  The default
1870Sstevel@tonic-gate  * snoop_interval is 50 seconds.
1880Sstevel@tonic-gate  */
1890Sstevel@tonic-gate #define	SNOOP_INTERVAL_MIN	(MICROSEC)
1900Sstevel@tonic-gate #define	SNOOP_INTERVAL_DEFAULT	(50 * MICROSEC)
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate int snooping = 0;
1930Sstevel@tonic-gate uint_t snoop_interval = SNOOP_INTERVAL_DEFAULT;
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate /*
1960Sstevel@tonic-gate  * Tables of initialization functions, called from main().
1970Sstevel@tonic-gate  */
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate extern void system_taskq_init(void);
2000Sstevel@tonic-gate extern void binit(void);
2010Sstevel@tonic-gate extern void space_init(void);
2020Sstevel@tonic-gate extern void dnlc_init(void);
2030Sstevel@tonic-gate extern void vfsinit(void);
2040Sstevel@tonic-gate extern void finit(void);
2050Sstevel@tonic-gate extern void strinit(void);
2060Sstevel@tonic-gate extern void flk_init(void);
2070Sstevel@tonic-gate extern void ftrace_init(void);
2080Sstevel@tonic-gate extern void softcall_init(void);
2090Sstevel@tonic-gate extern void ttyinit(void);
2100Sstevel@tonic-gate extern void schedctl_init(void);
2110Sstevel@tonic-gate extern void deadman_init(void);
2120Sstevel@tonic-gate extern void clock_timer_init(void);
2130Sstevel@tonic-gate extern void clock_realtime_init(void);
2140Sstevel@tonic-gate extern void clock_highres_init(void);
2155788Smv143129 extern void clock_tick_mp_init(void);
21611389SAlexander.Kolbasov@Sun.COM extern void cu_init(void);
2178048SMadhavan.Venkataraman@Sun.COM extern void callout_mp_init(void);
2188408SEric.Saxe@Sun.COM extern void cpu_seq_tbl_init(void);
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate void	(*init_tbl[])(void) = {
2210Sstevel@tonic-gate 	system_taskq_init,
2220Sstevel@tonic-gate 	binit,
2230Sstevel@tonic-gate 	space_init,
2240Sstevel@tonic-gate 	dnlc_init,
2250Sstevel@tonic-gate 	vfsinit,
2260Sstevel@tonic-gate 	finit,
2270Sstevel@tonic-gate 	strinit,
2280Sstevel@tonic-gate 	serializer_init,
2290Sstevel@tonic-gate 	softcall_init,
2300Sstevel@tonic-gate 	ttyinit,
2310Sstevel@tonic-gate 	as_init,
2320Sstevel@tonic-gate 	pvn_init,
2330Sstevel@tonic-gate 	anon_init,
2340Sstevel@tonic-gate 	segvn_init,
2350Sstevel@tonic-gate 	flk_init,
2368408SEric.Saxe@Sun.COM 	cpu_seq_tbl_init,
2370Sstevel@tonic-gate 	schedctl_init,
2380Sstevel@tonic-gate 	fdb_init,
2390Sstevel@tonic-gate 	deadman_init,
2400Sstevel@tonic-gate 	clock_timer_init,
2410Sstevel@tonic-gate 	clock_realtime_init,
2420Sstevel@tonic-gate 	clock_highres_init,
2430Sstevel@tonic-gate 	0
2440Sstevel@tonic-gate };
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate 
2475076Smishra #if defined(__sparc)
2485076Smishra 	extern void siron_mp_init();
2495076Smishra #endif
2505076Smishra 
2510Sstevel@tonic-gate /*
2520Sstevel@tonic-gate  * Any per cpu resources should be initialized via
2530Sstevel@tonic-gate  * an entry in mp_init_tbl().
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate void	(*mp_init_tbl[])(void) = {
2560Sstevel@tonic-gate 	ftrace_init,
2570Sstevel@tonic-gate 	cyclic_mp_init,
2585076Smishra #if defined(__sparc)
2595076Smishra 	siron_mp_init,
2605076Smishra #endif
2615788Smv143129 	clock_tick_mp_init,
26211389SAlexander.Kolbasov@Sun.COM 	cu_init,
2638048SMadhavan.Venkataraman@Sun.COM 	callout_mp_init,
2640Sstevel@tonic-gate 	0
2650Sstevel@tonic-gate };
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate int maxusers;		/* kitchen-sink knob for dynamic configuration */
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate /*
2700Sstevel@tonic-gate  * pidmax -- highest pid value assigned by the system
2710Sstevel@tonic-gate  * Settable in /etc/system
2720Sstevel@tonic-gate  */
2730Sstevel@tonic-gate int pidmax = DEFAULT_MAXPID;
2740Sstevel@tonic-gate 
2750Sstevel@tonic-gate /*
2760Sstevel@tonic-gate  * jump_pid - if set, this value is where pid numbers should start
2770Sstevel@tonic-gate  * after the first few system pids (0-3) are used.  If 0, pids are
2780Sstevel@tonic-gate  * chosen in the usual way. This variable can be used to quickly
2790Sstevel@tonic-gate  * create large pids (by setting it to 100000, for example). pids
2800Sstevel@tonic-gate  * less than this value will never be chosen.
2810Sstevel@tonic-gate  */
2820Sstevel@tonic-gate pid_t jump_pid = DEFAULT_JUMPPID;
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate /*
2850Sstevel@tonic-gate  * autoup -- used in struct var for dynamic config of the age a delayed-write
2860Sstevel@tonic-gate  * buffer must be in seconds before bdflush will write it out.
2870Sstevel@tonic-gate  */
2880Sstevel@tonic-gate #define	DEFAULT_AUTOUP	30
2890Sstevel@tonic-gate int autoup = DEFAULT_AUTOUP;
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate /*
2920Sstevel@tonic-gate  * bufhwm -- tuneable variable for struct var for v_bufhwm.
2930Sstevel@tonic-gate  * high water mark for buffer cache mem usage in units of K bytes.
2940Sstevel@tonic-gate  *
2950Sstevel@tonic-gate  * bufhwm_pct -- ditto, but given in % of physmem.
2960Sstevel@tonic-gate  */
2970Sstevel@tonic-gate int bufhwm = 0;
2980Sstevel@tonic-gate int bufhwm_pct = 0;
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate /*
3010Sstevel@tonic-gate  * Process table.
3020Sstevel@tonic-gate  */
3030Sstevel@tonic-gate int maxpid;
3040Sstevel@tonic-gate int max_nprocs;		/* set in param_init() */
3050Sstevel@tonic-gate int maxuprc;		/* set in param_init() */
3060Sstevel@tonic-gate int reserved_procs;
3070Sstevel@tonic-gate int nthread = 1;
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate /*
3100Sstevel@tonic-gate  * UFS tunables
3110Sstevel@tonic-gate  */
3120Sstevel@tonic-gate int ufs_ninode;		/* declared here due to backwards compatibility */
3130Sstevel@tonic-gate int ndquot;		/* declared here due to backwards compatibility */
3140Sstevel@tonic-gate 
3150Sstevel@tonic-gate /*
3160Sstevel@tonic-gate  * Exec switch table. This is used by the generic exec module
3170Sstevel@tonic-gate  * to switch out to the desired executable type, based on the
3180Sstevel@tonic-gate  * magic number. The currently supported types are ELF, a.out
3190Sstevel@tonic-gate  * (both NMAGIC and ZMAGIC), interpreter (#!) files,
3200Sstevel@tonic-gate  * and Java executables.
3210Sstevel@tonic-gate  */
3220Sstevel@tonic-gate /*
3230Sstevel@tonic-gate  * Magic numbers
3240Sstevel@tonic-gate  */
3250Sstevel@tonic-gate short elfmagic = 0x7f45;
3260Sstevel@tonic-gate short intpmagic = 0x2321;
3270Sstevel@tonic-gate short jmagic = 0x504b;
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate #if defined(__sparc)
3300Sstevel@tonic-gate short aout_nmagic = NMAGIC;
3310Sstevel@tonic-gate short aout_zmagic = ZMAGIC;
3320Sstevel@tonic-gate short aout_omagic = OMAGIC;
3330Sstevel@tonic-gate #endif
3340Sstevel@tonic-gate short nomagic = 0;
3350Sstevel@tonic-gate 
3360Sstevel@tonic-gate /*
3370Sstevel@tonic-gate  * Magic strings
3380Sstevel@tonic-gate  */
3390Sstevel@tonic-gate #define	ELF32MAGIC_STRING	"\x7f""ELF\x1"
3400Sstevel@tonic-gate #define	ELF64MAGIC_STRING	"\x7f""ELF\x2"
3410Sstevel@tonic-gate #define	INTPMAGIC_STRING	"#!"
3420Sstevel@tonic-gate #define	JAVAMAGIC_STRING	"PK\003\004"
3430Sstevel@tonic-gate #define	AOUT_OMAGIC_STRING	"\x1""\x07"	/* 0407 */
3440Sstevel@tonic-gate #define	AOUT_NMAGIC_STRING	"\x1""\x08"	/* 0410 */
3450Sstevel@tonic-gate #define	AOUT_ZMAGIC_STRING	"\x1""\x0b"	/* 0413 */
3460Sstevel@tonic-gate #define	NOMAGIC_STRING		""
3470Sstevel@tonic-gate 
3488462SApril.Chin@Sun.COM #define	SHBIN_CNTL(x)	((x)&037)
3498462SApril.Chin@Sun.COM #define	SHBINMAGIC_STRING {SHBIN_CNTL('k'), SHBIN_CNTL('s'), SHBIN_CNTL('h'), 0}
3508462SApril.Chin@Sun.COM #define	SHBINMAGIC_LEN	4
3518462SApril.Chin@Sun.COM 
3520Sstevel@tonic-gate char elf32magicstr[] = ELF32MAGIC_STRING;
3530Sstevel@tonic-gate char elf64magicstr[] = ELF64MAGIC_STRING;
3540Sstevel@tonic-gate char intpmagicstr[] = INTPMAGIC_STRING;
3558462SApril.Chin@Sun.COM char shbinmagicstr[] = SHBINMAGIC_STRING;
3560Sstevel@tonic-gate char javamagicstr[] = JAVAMAGIC_STRING;
3570Sstevel@tonic-gate #if defined(__sparc)
3580Sstevel@tonic-gate char aout_nmagicstr[] = AOUT_NMAGIC_STRING;
3590Sstevel@tonic-gate char aout_zmagicstr[] = AOUT_ZMAGIC_STRING;
3600Sstevel@tonic-gate char aout_omagicstr[] = AOUT_OMAGIC_STRING;
3610Sstevel@tonic-gate #endif
3620Sstevel@tonic-gate char nomagicstr[] = NOMAGIC_STRING;
3630Sstevel@tonic-gate 
3640Sstevel@tonic-gate char *execswnames[] = {
3650Sstevel@tonic-gate 	"elfexec",	/* Elf32 */
3660Sstevel@tonic-gate #ifdef _LP64
3670Sstevel@tonic-gate 	"elfexec",	/* Elf64 */
3680Sstevel@tonic-gate #endif
3690Sstevel@tonic-gate 	"intpexec",
3708462SApril.Chin@Sun.COM 	"shbinexec",
3710Sstevel@tonic-gate 	"javaexec",
3720Sstevel@tonic-gate #if defined(__sparc)
3730Sstevel@tonic-gate 	"aoutexec",
3740Sstevel@tonic-gate 	"aoutexec",
3750Sstevel@tonic-gate 	"aoutexec",
3760Sstevel@tonic-gate #endif
3770Sstevel@tonic-gate 	NULL,
3780Sstevel@tonic-gate 	NULL,
3790Sstevel@tonic-gate 	NULL
3800Sstevel@tonic-gate };
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate struct execsw execsw[] = {
3830Sstevel@tonic-gate 	{ elf32magicstr, 0, 5, NULL, NULL, NULL },
3840Sstevel@tonic-gate #ifdef _LP64
3850Sstevel@tonic-gate 	{ elf64magicstr, 0, 5, NULL, NULL, NULL },
3860Sstevel@tonic-gate #endif
3870Sstevel@tonic-gate 	{ intpmagicstr, 0, 2, NULL, NULL, NULL },
3888462SApril.Chin@Sun.COM 	{ shbinmagicstr, 0, SHBINMAGIC_LEN, NULL, NULL, NULL },
3890Sstevel@tonic-gate 	{ javamagicstr, 0, 4, NULL, NULL, NULL },
3900Sstevel@tonic-gate #if defined(__sparc)
3910Sstevel@tonic-gate 	{ aout_zmagicstr, 2, 2, NULL, NULL, NULL },
3920Sstevel@tonic-gate 	{ aout_nmagicstr, 2, 2, NULL, NULL, NULL },
3930Sstevel@tonic-gate 	{ aout_omagicstr, 2, 2, NULL, NULL, NULL },
3940Sstevel@tonic-gate #endif
3950Sstevel@tonic-gate 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
3960Sstevel@tonic-gate 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
3970Sstevel@tonic-gate 	{ nomagicstr, 0, 0, NULL, NULL, NULL },
3980Sstevel@tonic-gate 	{ nomagicstr, 0, 0, NULL, NULL, NULL }
3990Sstevel@tonic-gate };
4000Sstevel@tonic-gate int nexectype = sizeof (execsw) / sizeof (execsw[0]);	/* # of exec types */
4010Sstevel@tonic-gate kmutex_t execsw_lock;	/* Used for allocation of execsw entries */
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate /*
4040Sstevel@tonic-gate  * symbols added to make changing max-file-descriptors
4050Sstevel@tonic-gate  * simple via /etc/system
4060Sstevel@tonic-gate  */
4070Sstevel@tonic-gate #define	RLIM_FD_CUR 0x100
4080Sstevel@tonic-gate #define	RLIM_FD_MAX 0x10000
4090Sstevel@tonic-gate 
4100Sstevel@tonic-gate uint_t rlim_fd_cur = RLIM_FD_CUR;
4110Sstevel@tonic-gate uint_t rlim_fd_max = RLIM_FD_MAX;
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate /*
4140Sstevel@tonic-gate  * (Default resource limits were formerly declared here, but are now provided by
4150Sstevel@tonic-gate  * the more general resource controls framework.)
4160Sstevel@tonic-gate  */
4170Sstevel@tonic-gate 
4180Sstevel@tonic-gate /*
419577Smeem  * STREAMS tunables
4200Sstevel@tonic-gate  */
421577Smeem int	nstrpush = 9;		/* maximum # of modules/drivers on a stream */
422577Smeem ssize_t	strctlsz = 1024;	/* maximum size of user-generated M_PROTO */
423577Smeem ssize_t	strmsgsz = 0x10000;	/* maximum size of user-generated M_DATA */
424577Smeem 				/* for `strmsgsz', zero means unlimited */
4250Sstevel@tonic-gate /*
426577Smeem  * Filesystem tunables
4270Sstevel@tonic-gate  */
4280Sstevel@tonic-gate int	rstchown = 1;		/* POSIX_CHOWN_RESTRICTED is enabled */
4290Sstevel@tonic-gate int	ngroups_max = NGROUPS_MAX_DEFAULT;
4300Sstevel@tonic-gate 
4310Sstevel@tonic-gate /*
4320Sstevel@tonic-gate  * generic scheduling stuff
4330Sstevel@tonic-gate  *
4340Sstevel@tonic-gate  * Configurable parameters for RT and TS are in the respective
4350Sstevel@tonic-gate  * scheduling class modules.
4360Sstevel@tonic-gate  */
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate pri_t maxclsyspri = MAXCLSYSPRI;
4390Sstevel@tonic-gate pri_t minclsyspri = MINCLSYSPRI;
4400Sstevel@tonic-gate char sys_name[] = "SYS";
4410Sstevel@tonic-gate 
4420Sstevel@tonic-gate extern pri_t sys_init();
4430Sstevel@tonic-gate extern classfuncs_t sys_classfuncs;
4440Sstevel@tonic-gate 
4450Sstevel@tonic-gate sclass_t sclass[] = {
4460Sstevel@tonic-gate 	{ "SYS",	sys_init,	&sys_classfuncs, STATIC_SCHED, 0 },
4470Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4480Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4490Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4500Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4510Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4520Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4530Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4540Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 },
4550Sstevel@tonic-gate 	{ "",	NULL,	NULL,	NULL, 0 }
4560Sstevel@tonic-gate };
4570Sstevel@tonic-gate 
4580Sstevel@tonic-gate int loaded_classes = 1;		/* for loaded classes */
4590Sstevel@tonic-gate kmutex_t class_lock;		/* lock for class[] */
4600Sstevel@tonic-gate 
4610Sstevel@tonic-gate int nclass = sizeof (sclass) / sizeof (sclass_t);
4620Sstevel@tonic-gate char initcls[] = "TS";
4630Sstevel@tonic-gate char *defaultclass = initcls;
4640Sstevel@tonic-gate 
4650Sstevel@tonic-gate /*
4660Sstevel@tonic-gate  * Tunable system parameters.
4670Sstevel@tonic-gate  */
4680Sstevel@tonic-gate 
4690Sstevel@tonic-gate /*
4700Sstevel@tonic-gate  * The integers tune_* are done this way so that the tune
4710Sstevel@tonic-gate  * data structure may be "tuned" if necessary from the /etc/system
4720Sstevel@tonic-gate  * file. The tune data structure is initialized in param_init();
4730Sstevel@tonic-gate  */
4740Sstevel@tonic-gate 
4750Sstevel@tonic-gate tune_t tune;
4760Sstevel@tonic-gate 
4770Sstevel@tonic-gate /*
4780Sstevel@tonic-gate  * If freemem < t_getpgslow, then start to steal pages from processes.
4790Sstevel@tonic-gate  */
4800Sstevel@tonic-gate int tune_t_gpgslo = 25;
4810Sstevel@tonic-gate 
4820Sstevel@tonic-gate /*
4830Sstevel@tonic-gate  * Rate at which fsflush is run, in seconds.
4840Sstevel@tonic-gate  */
4850Sstevel@tonic-gate #define	DEFAULT_TUNE_T_FSFLUSHR	1
4860Sstevel@tonic-gate int tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
4870Sstevel@tonic-gate 
4880Sstevel@tonic-gate /*
4890Sstevel@tonic-gate  * The minimum available resident (not swappable) memory to maintain
4900Sstevel@tonic-gate  * in order to avoid deadlock.  In pages.
4910Sstevel@tonic-gate  */
4920Sstevel@tonic-gate int tune_t_minarmem = 25;
4930Sstevel@tonic-gate 
4940Sstevel@tonic-gate /*
4950Sstevel@tonic-gate  * The minimum available swappable memory to maintain in order to avoid
4960Sstevel@tonic-gate  * deadlock.  In pages.
4970Sstevel@tonic-gate  */
4980Sstevel@tonic-gate int tune_t_minasmem = 25;
4990Sstevel@tonic-gate 
5000Sstevel@tonic-gate int tune_t_flckrec = 512;	/* max # of active frlocks */
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate /*
5030Sstevel@tonic-gate  * Number of currently available pages that cannot be 'locked'
5040Sstevel@tonic-gate  * This is set in init_pages_pp_maximum, and must be initialized
5050Sstevel@tonic-gate  * to zero here to detect an override in /etc/system
5060Sstevel@tonic-gate  */
5070Sstevel@tonic-gate pgcnt_t pages_pp_maximum = 0;
5080Sstevel@tonic-gate 
5090Sstevel@tonic-gate int boothowto;			/* boot flags passed to kernel */
5100Sstevel@tonic-gate struct var v;			/* System Configuration Information */
5110Sstevel@tonic-gate 
5120Sstevel@tonic-gate /*
5130Sstevel@tonic-gate  * System Configuration Information
5140Sstevel@tonic-gate  */
5150Sstevel@tonic-gate 
5168662SJordan.Vaughan@Sun.com /*
5178662SJordan.Vaughan@Sun.com  * The physical system's host identifier, expressed as a decimal string.
5188662SJordan.Vaughan@Sun.com  * Code should only directly access this value when writing to it (setting the
5198662SJordan.Vaughan@Sun.com  * physical system's host identifier).  Code that reads the physical system's
5208662SJordan.Vaughan@Sun.com  * host identifier should use zone_get_hostid(NULL) instead.
5218662SJordan.Vaughan@Sun.com  */
5228662SJordan.Vaughan@Sun.com char hw_serial[HW_HOSTID_LEN] = "0";
5238662SJordan.Vaughan@Sun.com 
5240Sstevel@tonic-gate #if defined(__sparc)
5250Sstevel@tonic-gate 
5260Sstevel@tonic-gate /*
5270Sstevel@tonic-gate  * On sparc machines, read hw_serial from the firmware at boot time
528*13038Sanil.udupa@sun.com  * and simply assert Oracle is the hardware provider.
5290Sstevel@tonic-gate  */
5300Sstevel@tonic-gate char architecture[] = "sparcv9";
5310Sstevel@tonic-gate char architecture_32[] = "sparc";
532*13038Sanil.udupa@sun.com char hw_provider[] = "Oracle Corporation";
5330Sstevel@tonic-gate 
5340Sstevel@tonic-gate #elif defined(__i386)
5350Sstevel@tonic-gate 
5360Sstevel@tonic-gate /*
5370Sstevel@tonic-gate  * On x86 machines, read hw_serial, hw_provider and srpc_domain from
5380Sstevel@tonic-gate  * /etc/bootrc at boot time.
5390Sstevel@tonic-gate  */
5400Sstevel@tonic-gate char architecture[] = "i386";
5410Sstevel@tonic-gate char architecture_32[] = "i386";
5420Sstevel@tonic-gate char hw_provider[SYS_NMLN] = "";
5430Sstevel@tonic-gate 
5440Sstevel@tonic-gate #elif defined(__amd64)
5450Sstevel@tonic-gate 
5460Sstevel@tonic-gate /*
5470Sstevel@tonic-gate  * On amd64 machines, read hw_serial, hw_provider and srpc_domain from
5480Sstevel@tonic-gate  * /etc/bootrc at boot time.
5490Sstevel@tonic-gate  */
5500Sstevel@tonic-gate char architecture[] = "amd64";
5510Sstevel@tonic-gate char architecture_32[] = "i386";
5520Sstevel@tonic-gate char hw_provider[SYS_NMLN] = "";
5530Sstevel@tonic-gate 
5540Sstevel@tonic-gate #else
5550Sstevel@tonic-gate #error "unknown processor architecture"
5560Sstevel@tonic-gate #endif
5570Sstevel@tonic-gate 
5580Sstevel@tonic-gate char srpc_domain[SYS_NMLN] = "";
5590Sstevel@tonic-gate char platform[SYS_NMLN] = "";	/* read from the devinfo root node */
5600Sstevel@tonic-gate 
5610Sstevel@tonic-gate /* Initialize isa_list */
5620Sstevel@tonic-gate char *isa_list = architecture;
5630Sstevel@tonic-gate 
5640Sstevel@tonic-gate static pgcnt_t original_physmem = 0;
5650Sstevel@tonic-gate 
5660Sstevel@tonic-gate #define	MIN_DEFAULT_MAXUSERS	8u
5670Sstevel@tonic-gate #define	MAX_DEFAULT_MAXUSERS	2048u
5680Sstevel@tonic-gate #define	MAX_MAXUSERS		4096u
5690Sstevel@tonic-gate 
5700Sstevel@tonic-gate void
param_preset(void)5710Sstevel@tonic-gate param_preset(void)
5720Sstevel@tonic-gate {
5730Sstevel@tonic-gate 	original_physmem = physmem;
5740Sstevel@tonic-gate }
5750Sstevel@tonic-gate 
5760Sstevel@tonic-gate void
param_calc(int platform_max_nprocs)5770Sstevel@tonic-gate param_calc(int platform_max_nprocs)
5780Sstevel@tonic-gate {
5790Sstevel@tonic-gate 	/*
5800Sstevel@tonic-gate 	 * Default to about one "user" per megabyte, taking into
5810Sstevel@tonic-gate 	 * account both physical and virtual constraints.
5820Sstevel@tonic-gate 	 * Note: 2^20 is a meg; shifting right by (20 - PAGESHIFT)
5830Sstevel@tonic-gate 	 * converts pages to megs without integer overflow.
5840Sstevel@tonic-gate 	 */
5851417Skchow #if defined(__sparc)
5860Sstevel@tonic-gate 	if (physmem > original_physmem) {
5870Sstevel@tonic-gate 		physmem = original_physmem;
5880Sstevel@tonic-gate 		cmn_err(CE_NOTE, "physmem limited to %ld", physmem);
5890Sstevel@tonic-gate 	}
5901417Skchow #endif
5910Sstevel@tonic-gate 	if (maxusers == 0) {
5920Sstevel@tonic-gate 		pgcnt_t physmegs = physmem >> (20 - PAGESHIFT);
5930Sstevel@tonic-gate 		pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20;
5940Sstevel@tonic-gate 		maxusers = MIN(MAX(MIN(physmegs, virtmegs),
5950Sstevel@tonic-gate 		    MIN_DEFAULT_MAXUSERS), MAX_DEFAULT_MAXUSERS);
5960Sstevel@tonic-gate 	}
5970Sstevel@tonic-gate 	if (maxusers > MAX_MAXUSERS) {
5980Sstevel@tonic-gate 		maxusers = MAX_MAXUSERS;
5990Sstevel@tonic-gate 		cmn_err(CE_NOTE, "maxusers limited to %d", MAX_MAXUSERS);
6000Sstevel@tonic-gate 	}
6010Sstevel@tonic-gate 
6020Sstevel@tonic-gate 	if (ngroups_max > NGROUPS_MAX_DEFAULT)
6034828Sjosephb 		cmn_err(CE_WARN, "ngroups_max of %d > %d, NFS AUTH_SYS will"
6044828Sjosephb 		    " not work properly", ngroups_max, NGROUPS_MAX_DEFAULT);
6050Sstevel@tonic-gate 
6060Sstevel@tonic-gate #ifdef DEBUG
6070Sstevel@tonic-gate 	/*
6080Sstevel@tonic-gate 	 * The purpose of maxusers is to prevent memory overcommit.
6090Sstevel@tonic-gate 	 * DEBUG kernels take more space, so reduce maxusers a bit.
6100Sstevel@tonic-gate 	 */
6110Sstevel@tonic-gate 	maxusers = (3 * maxusers) / 4;
6120Sstevel@tonic-gate #endif
6130Sstevel@tonic-gate 
6140Sstevel@tonic-gate 	/*
6150Sstevel@tonic-gate 	 * We need to dynamically change any variables now so that
6160Sstevel@tonic-gate 	 * the setting of maxusers and pidmax propagate to the other
6170Sstevel@tonic-gate 	 * variables that are dependent on them.
6180Sstevel@tonic-gate 	 */
6190Sstevel@tonic-gate 	if (reserved_procs == 0)
6200Sstevel@tonic-gate 		reserved_procs = 5;
6210Sstevel@tonic-gate 	if (pidmax < reserved_procs || pidmax > MAX_MAXPID)
6220Sstevel@tonic-gate 		maxpid = MAX_MAXPID;
6230Sstevel@tonic-gate 	else
6240Sstevel@tonic-gate 		maxpid = pidmax;
6250Sstevel@tonic-gate 
6260Sstevel@tonic-gate 	/*
6270Sstevel@tonic-gate 	 * This allows platform-dependent code to constrain the maximum
6280Sstevel@tonic-gate 	 * number of processes allowed in case there are e.g. VM limitations
6290Sstevel@tonic-gate 	 * with how many contexts are available.
6300Sstevel@tonic-gate 	 */
6310Sstevel@tonic-gate 	if (max_nprocs == 0)
6320Sstevel@tonic-gate 		max_nprocs = (10 + 16 * maxusers);
6330Sstevel@tonic-gate 	if (platform_max_nprocs > 0 && max_nprocs > platform_max_nprocs)
6340Sstevel@tonic-gate 		max_nprocs = platform_max_nprocs;
6350Sstevel@tonic-gate 	if (max_nprocs > maxpid)
6360Sstevel@tonic-gate 		max_nprocs = maxpid;
6370Sstevel@tonic-gate 
6380Sstevel@tonic-gate 	if (maxuprc == 0)
6390Sstevel@tonic-gate 		maxuprc = (max_nprocs - reserved_procs);
6400Sstevel@tonic-gate }
6410Sstevel@tonic-gate 
6420Sstevel@tonic-gate void
param_init(void)6430Sstevel@tonic-gate param_init(void)
6440Sstevel@tonic-gate {
6450Sstevel@tonic-gate 	/*
6460Sstevel@tonic-gate 	 * Set each individual element of struct var v to be the
6470Sstevel@tonic-gate 	 * default value. This is done this way
6480Sstevel@tonic-gate 	 * so that a user can set the assigned integer value in the
6490Sstevel@tonic-gate 	 * /etc/system file *IF* tuning is needed.
6500Sstevel@tonic-gate 	 */
6510Sstevel@tonic-gate 	v.v_proc = max_nprocs;	/* v_proc - max # of processes system wide */
6520Sstevel@tonic-gate 	v.v_maxupttl = max_nprocs - reserved_procs;
6530Sstevel@tonic-gate 	v.v_maxsyspri = (int)maxclsyspri;  /* max global pri for sysclass */
6540Sstevel@tonic-gate 	v.v_maxup = MIN(maxuprc, v.v_maxupttl); /* max procs per user */
6550Sstevel@tonic-gate 	v.v_autoup = autoup;	/* v_autoup - delay for delayed writes */
6560Sstevel@tonic-gate 
6570Sstevel@tonic-gate 	/*
6580Sstevel@tonic-gate 	 * Set each individual element of struct tune to be the
6590Sstevel@tonic-gate 	 * default value. Each struct element This is done this way
6600Sstevel@tonic-gate 	 *  so that a user can set the assigned integer value in the
6610Sstevel@tonic-gate 	 * /etc/system file *IF* tuning is needed.
6620Sstevel@tonic-gate 	 */
6630Sstevel@tonic-gate 	tune.t_gpgslo = tune_t_gpgslo;
6640Sstevel@tonic-gate 	tune.t_fsflushr = tune_t_fsflushr;
6650Sstevel@tonic-gate 	tune.t_minarmem = tune_t_minarmem;
6660Sstevel@tonic-gate 	tune.t_minasmem = tune_t_minasmem;
6670Sstevel@tonic-gate 	tune.t_flckrec = tune_t_flckrec;
6680Sstevel@tonic-gate 
6690Sstevel@tonic-gate 	/*
6700Sstevel@tonic-gate 	 * Initialization for file descriptors to correct mistaken settings in
6710Sstevel@tonic-gate 	 * /etc/system.  Initialization of limits performed by resource control
6720Sstevel@tonic-gate 	 * system.
6730Sstevel@tonic-gate 	 */
6740Sstevel@tonic-gate 	if (rlim_fd_cur > rlim_fd_max)
6750Sstevel@tonic-gate 		rlim_fd_cur = rlim_fd_max;
6760Sstevel@tonic-gate 
6770Sstevel@tonic-gate 	/*
6780Sstevel@tonic-gate 	 * calculations needed if hz was set in /etc/system
6790Sstevel@tonic-gate 	 */
6800Sstevel@tonic-gate 	if (hires_tick)
6810Sstevel@tonic-gate 		hz = hires_hz;
6820Sstevel@tonic-gate 
6830Sstevel@tonic-gate 	tick_per_msec = hz / MILLISEC;
6840Sstevel@tonic-gate 	msec_per_tick = MILLISEC / hz;
6850Sstevel@tonic-gate 	usec_per_tick = MICROSEC / hz;
6860Sstevel@tonic-gate 	nsec_per_tick = NANOSEC / hz;
6870Sstevel@tonic-gate 	max_hres_adj = nsec_per_tick >> ADJ_SHIFT;
68811066Srafael.vanoni@sun.com 
68911066Srafael.vanoni@sun.com 	/*
69011066Srafael.vanoni@sun.com 	 * Consumers of relative timedwait functions must specify how accurately
69111066Srafael.vanoni@sun.com 	 * the given timeout must expire. This is currently TR_CLOCK_TICK for
69211066Srafael.vanoni@sun.com 	 * the vast majority of consumers, but nsec_per_tick becomes an
69311066Srafael.vanoni@sun.com 	 * artificial value in a tickless world. Each caller of such routines
69411066Srafael.vanoni@sun.com 	 * should re-evaluate their usage and specify the appropriate
69511066Srafael.vanoni@sun.com 	 * resolution.
69611066Srafael.vanoni@sun.com 	 */
69711066Srafael.vanoni@sun.com 	time_res[TR_NANOSEC] = SEC;
69811066Srafael.vanoni@sun.com 	time_res[TR_MICROSEC] = MILLISEC;
69911066Srafael.vanoni@sun.com 	time_res[TR_MILLISEC] = MICROSEC;
70011066Srafael.vanoni@sun.com 	time_res[TR_SEC] = NANOSEC;
70111066Srafael.vanoni@sun.com 	time_res[TR_CLOCK_TICK] = nsec_per_tick;
7020Sstevel@tonic-gate }
7030Sstevel@tonic-gate 
7040Sstevel@tonic-gate /*
7050Sstevel@tonic-gate  * Validate tuneable parameters following /etc/system processing,
7060Sstevel@tonic-gate  * but prior to param_init().
7070Sstevel@tonic-gate  */
7080Sstevel@tonic-gate void
param_check(void)7090Sstevel@tonic-gate param_check(void)
7100Sstevel@tonic-gate {
7114828Sjosephb #if defined(__x86)
7124828Sjosephb 	if (physmem != original_physmem) {
7134828Sjosephb 		cmn_err(CE_NOTE, "physmem cannot be modified to 0x%lx"
7144828Sjosephb 		    " via /etc/system. Please use eeprom(1M) instead.",
7154828Sjosephb 		    physmem);
7164828Sjosephb 		physmem = original_physmem;
7174828Sjosephb 	}
7184828Sjosephb #endif
71911134SCasper.Dik@Sun.COM 	if (ngroups_max < NGROUPS_UMIN)
72011134SCasper.Dik@Sun.COM 		ngroups_max = NGROUPS_UMIN;
72111134SCasper.Dik@Sun.COM 	if (ngroups_max > NGROUPS_UMAX)
72211134SCasper.Dik@Sun.COM 		ngroups_max = NGROUPS_UMAX;
72311134SCasper.Dik@Sun.COM 
72411134SCasper.Dik@Sun.COM 	/* If we have many groups then the ucred proto message also grows. */
72511134SCasper.Dik@Sun.COM 	if (ngroups_max > NGROUPS_OLDMAX &&
72611134SCasper.Dik@Sun.COM 	    strctlsz < (ngroups_max - NGROUPS_OLDMAX) * sizeof (gid_t) + 1024) {
72711134SCasper.Dik@Sun.COM 		strctlsz = (ngroups_max - NGROUPS_OLDMAX) * sizeof (gid_t) +
72811134SCasper.Dik@Sun.COM 		    1024;
72911134SCasper.Dik@Sun.COM 	}
7300Sstevel@tonic-gate 
7310Sstevel@tonic-gate 	if (autoup <= 0) {
7320Sstevel@tonic-gate 		autoup = DEFAULT_AUTOUP;
7330Sstevel@tonic-gate 		cmn_err(CE_WARN, "autoup <= 0; defaulting to %d", autoup);
7340Sstevel@tonic-gate 	}
7350Sstevel@tonic-gate 
7360Sstevel@tonic-gate 	if (tune_t_fsflushr <= 0) {
7370Sstevel@tonic-gate 		tune_t_fsflushr = DEFAULT_TUNE_T_FSFLUSHR;
7380Sstevel@tonic-gate 		cmn_err(CE_WARN, "tune_t_fsflushr <= 0; defaulting to %d",
7390Sstevel@tonic-gate 		    tune_t_fsflushr);
7400Sstevel@tonic-gate 	}
7410Sstevel@tonic-gate 
7420Sstevel@tonic-gate 	if (jump_pid < 0 || jump_pid >= pidmax) {
7430Sstevel@tonic-gate 		jump_pid = 0;
7440Sstevel@tonic-gate 		cmn_err(CE_WARN, "jump_pid < 0 or >= pidmax; ignored");
7450Sstevel@tonic-gate 	}
7460Sstevel@tonic-gate 
7470Sstevel@tonic-gate 	if (snoop_interval < SNOOP_INTERVAL_MIN) {
7480Sstevel@tonic-gate 		snoop_interval = SNOOP_INTERVAL_DEFAULT;
7490Sstevel@tonic-gate 		cmn_err(CE_WARN, "snoop_interval < minimum (%d); defaulting"
7500Sstevel@tonic-gate 		    " to %d", SNOOP_INTERVAL_MIN, SNOOP_INTERVAL_DEFAULT);
7510Sstevel@tonic-gate 	}
7520Sstevel@tonic-gate }
753