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 53446Smrj * Common Development and Distribution License (the "License"). 63446Smrj * 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 /* 2212230SFrank.Rival@oracle.com * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 260Sstevel@tonic-gate /* All Rights Reserved */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 300Sstevel@tonic-gate * The Regents of the University of California 310Sstevel@tonic-gate * All Rights Reserved 320Sstevel@tonic-gate * 330Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 340Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 350Sstevel@tonic-gate * contributors. 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifndef _SYS_PARAM_H 390Sstevel@tonic-gate #define _SYS_PARAM_H 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 420Sstevel@tonic-gate #include <sys/types.h> 430Sstevel@tonic-gate #include <sys/isa_defs.h> 440Sstevel@tonic-gate #endif /* _ASM */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate 470Sstevel@tonic-gate #ifdef __cplusplus 480Sstevel@tonic-gate extern "C" { 490Sstevel@tonic-gate #endif 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * Fundamental variables; don't change too often. 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* 560Sstevel@tonic-gate * _POSIX_VDISABLE has historically been defined in <sys/param.h> since 570Sstevel@tonic-gate * an early merge with AT&T source. It has also historically been defined 580Sstevel@tonic-gate * in <sys/termios.h>. The POSIX standard, IEEE Std. 1003.1-1988 initially 590Sstevel@tonic-gate * required the existence of _POSIX_VDISABLE in <sys/termios.h>. 600Sstevel@tonic-gate * Subsequent versions of the IEEE Standard as well as the X/Open 610Sstevel@tonic-gate * specifications required that _POSIX_VDISABLE be defined in <unistd.h> 620Sstevel@tonic-gate * while still allowing for it's existence in other headers. With the 630Sstevel@tonic-gate * introduction of XPG6, _POSIX_VDISABLE can only be defined in <unistd.h>. 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 660Sstevel@tonic-gate #ifndef _POSIX_VDISABLE 670Sstevel@tonic-gate #define _POSIX_VDISABLE 0 /* Disable special character functions */ 680Sstevel@tonic-gate #endif 690Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate #ifndef MAX_INPUT 720Sstevel@tonic-gate #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ 730Sstevel@tonic-gate #endif 740Sstevel@tonic-gate 750Sstevel@tonic-gate #ifndef MAX_CANON 760Sstevel@tonic-gate #define MAX_CANON 256 /* Maximum bytes for canonical processing */ 770Sstevel@tonic-gate #endif 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define UID_NOBODY 60001 /* user ID no body */ 800Sstevel@tonic-gate #define GID_NOBODY UID_NOBODY 8111567Slisa.week@sun.com #define UID_UNKNOWN 96 8211567Slisa.week@sun.com #define GID_UNKNOWN UID_UNKNOWN 836173Syz147064 #define UID_DLADM 15 8411767SAnurag.Maskey@Sun.COM #define UID_NETADM 16 8511767SAnurag.Maskey@Sun.COM #define GID_NETADM 65 860Sstevel@tonic-gate #define UID_NOACCESS 60002 /* user ID no access */ 870Sstevel@tonic-gate 880Sstevel@tonic-gate #ifdef _KERNEL 890Sstevel@tonic-gate #define MAX_TASKID 999999 900Sstevel@tonic-gate #define MAX_MAXPID 999999 914321Scasper #define MAXEPHUID 0xfffffffcu /* max ephemeral user id */ 9211173SJonathan.Adams@Sun.COM 9311173SJonathan.Adams@Sun.COM #define FAMOUS_PID_SCHED 0 9411173SJonathan.Adams@Sun.COM #define FAMOUS_PID_INIT 1 9511173SJonathan.Adams@Sun.COM #define FAMOUS_PID_PAGEOUT 2 9611173SJonathan.Adams@Sun.COM #define FAMOUS_PID_FSFLUSH 3 9711173SJonathan.Adams@Sun.COM #define FAMOUS_PIDS 4 980Sstevel@tonic-gate #endif 990Sstevel@tonic-gate 1000Sstevel@tonic-gate #ifdef DEBUG 1010Sstevel@tonic-gate #define DEFAULT_MAXPID 999999 1020Sstevel@tonic-gate #define DEFAULT_JUMPPID 100000 1030Sstevel@tonic-gate #else 1040Sstevel@tonic-gate #define DEFAULT_MAXPID 30000 1050Sstevel@tonic-gate #define DEFAULT_JUMPPID 0 1060Sstevel@tonic-gate #endif 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #define MAXUID 2147483647 /* max user id */ 1094321Scasper 1100Sstevel@tonic-gate #define MAXPROJID MAXUID /* max project id */ 1110Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 1120Sstevel@tonic-gate 1134321Scasper #define MINEPHUID 0x80000000u /* min ephemeral user id */ 1144321Scasper 1150Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate #define CANBSIZ 256 /* max size of typewriter line */ 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate #define NOFILE 20 /* this define is here for */ 1200Sstevel@tonic-gate /* compatibility purposes only */ 1210Sstevel@tonic-gate /* and will be removed in a */ 1220Sstevel@tonic-gate /* later release */ 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* 1250Sstevel@tonic-gate * These define the maximum and minimum allowable values of the 1260Sstevel@tonic-gate * configurable parameter NGROUPS_MAX. 1270Sstevel@tonic-gate */ 1280Sstevel@tonic-gate #define NGROUPS_UMIN 0 12911134SCasper.Dik@Sun.COM #define NGROUPS_UMAX 1024 13011134SCasper.Dik@Sun.COM #define NGROUPS_OLDMAX 32 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate /* 1330Sstevel@tonic-gate * NGROUPS_MAX_DEFAULT: *MUST* match NGROUPS_MAX value in limits.h. 1340Sstevel@tonic-gate * Remember that the NFS protocol must rev. before this can be increased 1350Sstevel@tonic-gate */ 1360Sstevel@tonic-gate #define NGROUPS_MAX_DEFAULT 16 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate /* 1390Sstevel@tonic-gate * Default process priority. Keep it in sync with limits.h. 1400Sstevel@tonic-gate */ 1410Sstevel@tonic-gate #define NZERO 20 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate /* 1440Sstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily. 1450Sstevel@tonic-gate */ 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #ifndef NULL 1500Sstevel@tonic-gate #if defined(_LP64) 1510Sstevel@tonic-gate #define NULL 0L 1520Sstevel@tonic-gate #else 1530Sstevel@tonic-gate #define NULL 0 1540Sstevel@tonic-gate #endif 1550Sstevel@tonic-gate #endif 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate #define CMASK 022 /* default mask for file creation */ 1580Sstevel@tonic-gate #define CDLIMIT (1L<<11) /* default max write address */ 1590Sstevel@tonic-gate #define NBPS 0x20000 /* Number of bytes per segment */ 1600Sstevel@tonic-gate #define NBPSCTR 512 /* Bytes per disk sector. */ 1610Sstevel@tonic-gate #define UBSIZE 512 /* unix block size. */ 1620Sstevel@tonic-gate #define SCTRSHFT 9 /* Shift for BPSECT. */ 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate #ifdef _LITTLE_ENDIAN 1650Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[0]) 1660Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[1]) 1670Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[0]) 1680Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[1]) 1690Sstevel@tonic-gate #endif 1700Sstevel@tonic-gate #ifdef _BIG_ENDIAN 1710Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[1]) 1720Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[0]) 1730Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[1]) 1740Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[0]) 1750Sstevel@tonic-gate #endif 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate /* REMOTE -- whether machine is primary, secondary, or regular */ 1780Sstevel@tonic-gate #define SYSNAME 9 /* # chars in system name */ 1790Sstevel@tonic-gate #define PREMOTE 39 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate /* 1820Sstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length, 1830Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 1840Sstevel@tonic-gate * TYPICALMAXPATHLEN is used in a few places as an optimization 1850Sstevel@tonic-gate * with a local buffer on the stack to avoid kmem_alloc(). 1860Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 1870Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 1880Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 1890Sstevel@tonic-gate * reasonably quickly. 1900Sstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of 1910Sstevel@tonic-gate * the longest permissible file (component) name. 1920Sstevel@tonic-gate */ 1930Sstevel@tonic-gate #define MAXPATHLEN 1024 1940Sstevel@tonic-gate #define TYPICALMAXPATHLEN 64 1950Sstevel@tonic-gate #define MAXSYMLINKS 20 1960Sstevel@tonic-gate #define MAXNAMELEN 256 1970Sstevel@tonic-gate 1985895Syz147064 /* 1995895Syz147064 * MAXLINKNAMELEN defines the longest possible permitted datalink name, 2005895Syz147064 * including the terminating NUL. Note that this must not be larger 2015895Syz147064 * than related networking constants such as LIFNAMSIZ. 2025895Syz147064 */ 2035895Syz147064 #define MAXLINKNAMELEN 32 2045895Syz147064 2050Sstevel@tonic-gate #ifndef NADDR 2060Sstevel@tonic-gate #define NADDR 13 2070Sstevel@tonic-gate #endif 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate /* 2100Sstevel@tonic-gate * The following are defined to be the same as 2110Sstevel@tonic-gate * defined in /usr/include/limits.h. They are 2120Sstevel@tonic-gate * needed for pipe and FIFO compatibility. 2130Sstevel@tonic-gate */ 2140Sstevel@tonic-gate #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ 2150Sstevel@tonic-gate #define PIPE_BUF 5120 2160Sstevel@tonic-gate #endif /* PIPE_BUF */ 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ 2190Sstevel@tonic-gate #define PIPE_MAX 5120 2200Sstevel@tonic-gate #endif /* PIPE_MAX */ 2210Sstevel@tonic-gate 2220Sstevel@tonic-gate #ifndef NBBY 2230Sstevel@tonic-gate #define NBBY 8 /* number of bits per byte */ 2240Sstevel@tonic-gate #endif 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate /* macros replacing interleaving functions */ 2270Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 2280Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 2290Sstevel@tonic-gate 2300Sstevel@tonic-gate /* 2310Sstevel@tonic-gate * File system parameters and macros. 2320Sstevel@tonic-gate * 2330Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 2340Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 2350Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 2360Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 2370Sstevel@tonic-gate * file systems; however making it smaller make make some file 2380Sstevel@tonic-gate * systems unmountable. 2390Sstevel@tonic-gate * 2400Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 2410Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 2420Sstevel@tonic-gate */ 2430Sstevel@tonic-gate #define MAXBSIZE 8192 2440Sstevel@tonic-gate #define DEV_BSIZE 512 2450Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 2460Sstevel@tonic-gate #define MAXFRAG 8 2470Sstevel@tonic-gate #ifdef _SYSCALL32 2480Sstevel@tonic-gate #define MAXOFF32_T 0x7fffffff 2490Sstevel@tonic-gate #endif 2500Sstevel@tonic-gate #ifdef _LP64 2510Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffffffffffl 2520Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffl 2530Sstevel@tonic-gate #else 2540Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffl 2550Sstevel@tonic-gate #ifdef _LONGLONG_TYPE 2560Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffLL 2570Sstevel@tonic-gate #else 2580Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffff 2590Sstevel@tonic-gate #endif 2600Sstevel@tonic-gate #endif /* _LP64 */ 2610Sstevel@tonic-gate 2620Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2630Sstevel@tonic-gate ((unsigned long)(bytes) >> DEV_BSHIFT) 2640Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2650Sstevel@tonic-gate ((unsigned long)(db) << DEV_BSHIFT) 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate /* 64 bit versions of btodb and dbtob */ 2680Sstevel@tonic-gate #define lbtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2690Sstevel@tonic-gate ((u_offset_t)(bytes) >> DEV_BSHIFT) 2700Sstevel@tonic-gate #define ldbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2710Sstevel@tonic-gate ((u_offset_t)(db) << DEV_BSHIFT) 2720Sstevel@tonic-gate 2730Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 2740Sstevel@tonic-gate #ifndef NODEV 2750Sstevel@tonic-gate #define NODEV (dev_t)(-1l) 2760Sstevel@tonic-gate #ifdef _SYSCALL32 2770Sstevel@tonic-gate #define NODEV32 (dev32_t)(-1) 2780Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2790Sstevel@tonic-gate #endif /* NODEV */ 2800Sstevel@tonic-gate #endif /* _ASM */ 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate /* 2830Sstevel@tonic-gate * Size of arg list passed in by user. 2840Sstevel@tonic-gate */ 2850Sstevel@tonic-gate #define NCARGS32 0x100000 2860Sstevel@tonic-gate #define NCARGS64 0x200000 2870Sstevel@tonic-gate #ifdef _LP64 2880Sstevel@tonic-gate #define NCARGS NCARGS64 2890Sstevel@tonic-gate #else /* _LP64 */ 2900Sstevel@tonic-gate #define NCARGS NCARGS32 2910Sstevel@tonic-gate #endif /* _LP64 */ 2920Sstevel@tonic-gate 2930Sstevel@tonic-gate /* 2940Sstevel@tonic-gate * Scale factor for scaled integers used to count 2950Sstevel@tonic-gate * %cpu time and load averages. 2960Sstevel@tonic-gate */ 2970Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 2980Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate /* 3010Sstevel@tonic-gate * Delay units are in microseconds. 3020Sstevel@tonic-gate * 3030Sstevel@tonic-gate * XXX These macros are not part of the DDI! 3040Sstevel@tonic-gate */ 3050Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3060Sstevel@tonic-gate extern void drv_usecwait(clock_t); 3070Sstevel@tonic-gate #define DELAY(n) drv_usecwait(n) 3080Sstevel@tonic-gate #define CDELAY(c, n) \ 3090Sstevel@tonic-gate { \ 3100Sstevel@tonic-gate register int N = n; \ 3110Sstevel@tonic-gate while (--N > 0) { \ 3120Sstevel@tonic-gate if (c) \ 3130Sstevel@tonic-gate break; \ 3140Sstevel@tonic-gate drv_usecwait(1); \ 3150Sstevel@tonic-gate } \ 3160Sstevel@tonic-gate } 3170Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3180Sstevel@tonic-gate 3190Sstevel@tonic-gate #ifdef __cplusplus 3200Sstevel@tonic-gate } 3210Sstevel@tonic-gate #endif 3220Sstevel@tonic-gate 3230Sstevel@tonic-gate /* 3240Sstevel@tonic-gate * The following is to free utilities from machine dependencies within 3250Sstevel@tonic-gate * an architecture. Must be included after definition of DEV_BSIZE. 3260Sstevel@tonic-gate */ 3270Sstevel@tonic-gate 3280Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate #if defined(_MACHDEP) 3310Sstevel@tonic-gate #include <sys/machparam.h> 3320Sstevel@tonic-gate #endif 3330Sstevel@tonic-gate 3340Sstevel@tonic-gate #ifdef __cplusplus 3350Sstevel@tonic-gate extern "C" { 3360Sstevel@tonic-gate #endif 3370Sstevel@tonic-gate 3380Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3390Sstevel@tonic-gate extern int cpu_decay_factor; 3400Sstevel@tonic-gate extern pid_t maxpid; 3410Sstevel@tonic-gate extern pid_t jump_pid; 3420Sstevel@tonic-gate 3430Sstevel@tonic-gate extern uintptr_t _kernelbase; 3440Sstevel@tonic-gate extern uintptr_t _userlimit; 3450Sstevel@tonic-gate extern uintptr_t _userlimit32; 3460Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3470Sstevel@tonic-gate 3487632SNick.Todd@Sun.COM /* 3497632SNick.Todd@Sun.COM * These three variables have been added within the #if defined(lint) 3507632SNick.Todd@Sun.COM * below to ensure visibility to lint. This is a short term workaround 3517632SNick.Todd@Sun.COM * to handle poor interaction between SS12 lint and these variables. 3527632SNick.Todd@Sun.COM * CR 6742611 has been logged to address these issues. 3537632SNick.Todd@Sun.COM */ 3547632SNick.Todd@Sun.COM #if defined(lint) 3557632SNick.Todd@Sun.COM extern int snooping; 3567632SNick.Todd@Sun.COM extern uint_t snoop_interval; 3577632SNick.Todd@Sun.COM extern const unsigned int _pageshift; 3587632SNick.Todd@Sun.COM #endif /* lint */ 3590Sstevel@tonic-gate 3600Sstevel@tonic-gate #if !defined(_MACHDEP) 3610Sstevel@tonic-gate 3620Sstevel@tonic-gate /* 3630Sstevel@tonic-gate * Implementation architecture independent sections of the kernel use 3640Sstevel@tonic-gate * this section. 3650Sstevel@tonic-gate */ 3660Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3670Sstevel@tonic-gate extern int hz; 3680Sstevel@tonic-gate extern int snooping; 3690Sstevel@tonic-gate extern uint_t snoop_interval; 3700Sstevel@tonic-gate extern const unsigned long _pagesize; 3710Sstevel@tonic-gate extern const unsigned int _pageshift; 3720Sstevel@tonic-gate extern const unsigned long _pageoffset; 3730Sstevel@tonic-gate extern const unsigned long long _pagemask; 3740Sstevel@tonic-gate extern const unsigned long _mmu_pagesize; 3750Sstevel@tonic-gate extern const unsigned int _mmu_pageshift; 3760Sstevel@tonic-gate extern const unsigned long _mmu_pageoffset; 3770Sstevel@tonic-gate extern const unsigned long _mmu_pagemask; 3780Sstevel@tonic-gate extern const uintptr_t _argsbase; 3790Sstevel@tonic-gate extern const unsigned long _defaultstksz; 3800Sstevel@tonic-gate extern const unsigned int _nbpg; 3810Sstevel@tonic-gate extern const int _ncpu; 38212173SMichael.Corcoran@Sun.COM extern const int _ncpu_log2; 38312230SFrank.Rival@oracle.com extern const int _ncpu_p2; 3840Sstevel@tonic-gate extern const int _clsize; 3850Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3860Sstevel@tonic-gate 387*13076SJonathan.Adams@Sun.COM /* Any additions to these #defines must be reflected in mdb_param.h+mdb_ks.c */ 3880Sstevel@tonic-gate #define PAGESIZE _pagesize 3890Sstevel@tonic-gate #define PAGESHIFT _pageshift 3900Sstevel@tonic-gate #define PAGEOFFSET _pageoffset 3910Sstevel@tonic-gate #define PAGEMASK _pagemask 3920Sstevel@tonic-gate #define MMU_PAGESIZE _mmu_pagesize 3930Sstevel@tonic-gate #define MMU_PAGESHIFT _mmu_pageshift 3940Sstevel@tonic-gate #define MMU_PAGEOFFSET _mmu_pageoffset 3950Sstevel@tonic-gate #define MMU_PAGEMASK _mmu_pagemask 3960Sstevel@tonic-gate 3970Sstevel@tonic-gate #define KERNELBASE _kernelbase 3980Sstevel@tonic-gate #define USERLIMIT _userlimit 3990Sstevel@tonic-gate #define USERLIMIT32 _userlimit32 4000Sstevel@tonic-gate #define ARGSBASE _argsbase 4010Sstevel@tonic-gate #define DEFAULTSTKSZ _defaultstksz 4020Sstevel@tonic-gate #define NCPU _ncpu 40312173SMichael.Corcoran@Sun.COM #define NCPU_LOG2 _ncpu_log2 40412230SFrank.Rival@oracle.com #define NCPU_P2 _ncpu_p2 4050Sstevel@tonic-gate 4060Sstevel@tonic-gate #endif /* defined(_MACHDEP) */ 4070Sstevel@tonic-gate 4080Sstevel@tonic-gate /* 4090Sstevel@tonic-gate * Some random macros for units conversion. 4100Sstevel@tonic-gate * 4110Sstevel@tonic-gate * These are machine independent but contain constants (*PAGESHIFT) which 4120Sstevel@tonic-gate * are only defined in the machine dependent file. 4130Sstevel@tonic-gate */ 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate /* 4160Sstevel@tonic-gate * MMU pages to bytes, and back (with and without rounding) 4170Sstevel@tonic-gate */ 4180Sstevel@tonic-gate #define mmu_ptob(x) ((x) << MMU_PAGESHIFT) 4190Sstevel@tonic-gate #define mmu_btop(x) (((x)) >> MMU_PAGESHIFT) 4200Sstevel@tonic-gate #define mmu_btopr(x) ((((x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) 4210Sstevel@tonic-gate 4220Sstevel@tonic-gate /* 4230Sstevel@tonic-gate * 2 versions of pages to disk blocks 4240Sstevel@tonic-gate */ 4250Sstevel@tonic-gate #define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) 4260Sstevel@tonic-gate #define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) 4270Sstevel@tonic-gate 4280Sstevel@tonic-gate /* 4290Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 4300Sstevel@tonic-gate * Large Files: The explicit cast of x to unsigned int is deliberately 4310Sstevel@tonic-gate * removed as part of large files work. We pass longlong values to 4320Sstevel@tonic-gate * theses macros. 4330Sstevel@tonic-gate * 4340Sstevel@tonic-gate * Cast the input to ptob() to be a page count. This enforces 64-bit 4350Sstevel@tonic-gate * math on 64-bit kernels. For 32-bit kernels, callers must explicitly 4360Sstevel@tonic-gate * cast the input to be a 64-bit type if values greater than 4GB/PAGESIZE 4370Sstevel@tonic-gate * are possible. 4380Sstevel@tonic-gate */ 4390Sstevel@tonic-gate 4400Sstevel@tonic-gate #ifdef _LP64 4410Sstevel@tonic-gate #define ptob(x) (((pgcnt_t)(x)) << PAGESHIFT) 4420Sstevel@tonic-gate #else 4430Sstevel@tonic-gate #define ptob(x) ((x) << PAGESHIFT) 4440Sstevel@tonic-gate #endif /* _LP64 */ 4450Sstevel@tonic-gate #define btop(x) (((x) >> PAGESHIFT)) 4460Sstevel@tonic-gate #define btopr(x) ((((x) + PAGEOFFSET) >> PAGESHIFT)) 4470Sstevel@tonic-gate 4480Sstevel@tonic-gate /* 4490Sstevel@tonic-gate * disk blocks to pages, rounded and truncated 4500Sstevel@tonic-gate */ 4510Sstevel@tonic-gate #define NDPP (PAGESIZE/DEV_BSIZE) /* # of disk blocks per page */ 4520Sstevel@tonic-gate #define dtop(DD) (((DD) + NDPP - 1) >> (PAGESHIFT - DEV_BSHIFT)) 4530Sstevel@tonic-gate #define dtopt(DD) ((DD) >> (PAGESHIFT - DEV_BSHIFT)) 4540Sstevel@tonic-gate 4550Sstevel@tonic-gate /* 4563446Smrj * kB to pages and back 4573446Smrj */ 4583446Smrj #define kbtop(x) ((x) >> (PAGESHIFT - 10)) 4593446Smrj #define ptokb(x) ((x) << (PAGESHIFT - 10)) 4603446Smrj 4613446Smrj /* 4620Sstevel@tonic-gate * POSIX.4 related configuration parameters 4630Sstevel@tonic-gate */ 4640Sstevel@tonic-gate #define _AIO_LISTIO_MAX (4096) 4650Sstevel@tonic-gate #define _AIO_MAX (-1) 466203Scasper #define _MQ_OPEN_MAX (-1) 4670Sstevel@tonic-gate #define _MQ_PRIO_MAX (32) 4680Sstevel@tonic-gate #define _SEM_NSEMS_MAX INT_MAX 4690Sstevel@tonic-gate #define _SEM_VALUE_MAX INT_MAX 4700Sstevel@tonic-gate 4710Sstevel@tonic-gate #ifdef __cplusplus 4720Sstevel@tonic-gate } 4730Sstevel@tonic-gate #endif 4740Sstevel@tonic-gate 4750Sstevel@tonic-gate #else /* (defined(_KERNEL) || defined(_KMEMUSER)) */ 4760Sstevel@tonic-gate 4770Sstevel@tonic-gate /* 4780Sstevel@tonic-gate * The following are assorted machine dependent values which can be 4790Sstevel@tonic-gate * obtained in a machine independent manner through sysconf(2) or 4800Sstevel@tonic-gate * sysinfo(2). In order to guarantee that these provide the expected 4810Sstevel@tonic-gate * value at all times, the System Private interface (leading underscore) 4820Sstevel@tonic-gate * is used. 4830Sstevel@tonic-gate */ 4840Sstevel@tonic-gate 4850Sstevel@tonic-gate #include <sys/unistd.h> 4860Sstevel@tonic-gate 4870Sstevel@tonic-gate #ifdef __cplusplus 4880Sstevel@tonic-gate extern "C" { 4890Sstevel@tonic-gate #endif 4900Sstevel@tonic-gate 4910Sstevel@tonic-gate #if !defined(_ASM) 4920Sstevel@tonic-gate extern long _sysconf(int); /* System Private interface to sysconf() */ 4930Sstevel@tonic-gate #endif /* !defined(_ASM) */ 4940Sstevel@tonic-gate 4950Sstevel@tonic-gate #define HZ ((clock_t)_sysconf(_SC_CLK_TCK)) 4960Sstevel@tonic-gate #define TICK (1000000000/((clock_t)_sysconf(_SC_CLK_TCK))) 4970Sstevel@tonic-gate #define PAGESIZE (_sysconf(_SC_PAGESIZE)) 4980Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 4990Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 5000Sstevel@tonic-gate #define MAXPID ((pid_t)_sysconf(_SC_MAXPID)) 5014321Scasper #define MAXEPHUID ((uid_t)_sysconf(_SC_EPHID_MAX)) 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate #ifdef __cplusplus 5040Sstevel@tonic-gate } 5050Sstevel@tonic-gate #endif 5060Sstevel@tonic-gate 5070Sstevel@tonic-gate #endif /* (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP) */ 5080Sstevel@tonic-gate 5090Sstevel@tonic-gate #endif /* _SYS_PARAM_H */ 510