17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22d62bc4baSyz * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 317c478bd9Sstevel@tonic-gate * The Regents of the University of California 327c478bd9Sstevel@tonic-gate * All Rights Reserved 337c478bd9Sstevel@tonic-gate * 347c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 357c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 367c478bd9Sstevel@tonic-gate * contributors. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifndef _SYS_PARAM_H 407c478bd9Sstevel@tonic-gate #define _SYS_PARAM_H 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 437c478bd9Sstevel@tonic-gate #include <sys/types.h> 447c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 457c478bd9Sstevel@tonic-gate #endif /* _ASM */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 497c478bd9Sstevel@tonic-gate extern "C" { 507c478bd9Sstevel@tonic-gate #endif 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * Fundamental variables; don't change too often. 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* 577c478bd9Sstevel@tonic-gate * _POSIX_VDISABLE has historically been defined in <sys/param.h> since 587c478bd9Sstevel@tonic-gate * an early merge with AT&T source. It has also historically been defined 597c478bd9Sstevel@tonic-gate * in <sys/termios.h>. The POSIX standard, IEEE Std. 1003.1-1988 initially 607c478bd9Sstevel@tonic-gate * required the existence of _POSIX_VDISABLE in <sys/termios.h>. 617c478bd9Sstevel@tonic-gate * Subsequent versions of the IEEE Standard as well as the X/Open 627c478bd9Sstevel@tonic-gate * specifications required that _POSIX_VDISABLE be defined in <unistd.h> 637c478bd9Sstevel@tonic-gate * while still allowing for it's existence in other headers. With the 647c478bd9Sstevel@tonic-gate * introduction of XPG6, _POSIX_VDISABLE can only be defined in <unistd.h>. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 677c478bd9Sstevel@tonic-gate #ifndef _POSIX_VDISABLE 687c478bd9Sstevel@tonic-gate #define _POSIX_VDISABLE 0 /* Disable special character functions */ 697c478bd9Sstevel@tonic-gate #endif 707c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate #ifndef MAX_INPUT 737c478bd9Sstevel@tonic-gate #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ 747c478bd9Sstevel@tonic-gate #endif 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate #ifndef MAX_CANON 777c478bd9Sstevel@tonic-gate #define MAX_CANON 256 /* Maximum bytes for canonical processing */ 787c478bd9Sstevel@tonic-gate #endif 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate #define UID_NOBODY 60001 /* user ID no body */ 817c478bd9Sstevel@tonic-gate #define GID_NOBODY UID_NOBODY 82b9e076dcSyz #define GID_SYS 3 83b9e076dcSyz #define UID_DLADM 15 847c478bd9Sstevel@tonic-gate #define UID_NOACCESS 60002 /* user ID no access */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #ifdef _KERNEL 877c478bd9Sstevel@tonic-gate #define MAX_TASKID 999999 887c478bd9Sstevel@tonic-gate #define MAX_MAXPID 999999 89f48205beScasper #define MAXEPHUID 0xfffffffcu /* max ephemeral user id */ 907c478bd9Sstevel@tonic-gate #endif 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #ifdef DEBUG 937c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 999999 947c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 100000 957c478bd9Sstevel@tonic-gate #else 967c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 30000 977c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 0 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #endif 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #define MAXUID 2147483647 /* max user id */ 102f48205beScasper 1037c478bd9Sstevel@tonic-gate #define MAXPROJID MAXUID /* max project id */ 1047c478bd9Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 1057c478bd9Sstevel@tonic-gate 106f48205beScasper #define MINEPHUID 0x80000000u /* min ephemeral user id */ 107f48205beScasper 1087c478bd9Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate #define CANBSIZ 256 /* max size of typewriter line */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define NOFILE 20 /* this define is here for */ 1137c478bd9Sstevel@tonic-gate /* compatibility purposes only */ 1147c478bd9Sstevel@tonic-gate /* and will be removed in a */ 1157c478bd9Sstevel@tonic-gate /* later release */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* 1187c478bd9Sstevel@tonic-gate * These define the maximum and minimum allowable values of the 1197c478bd9Sstevel@tonic-gate * configurable parameter NGROUPS_MAX. 1207c478bd9Sstevel@tonic-gate */ 1217c478bd9Sstevel@tonic-gate #define NGROUPS_UMIN 0 1227c478bd9Sstevel@tonic-gate #define NGROUPS_UMAX 32 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* 1257c478bd9Sstevel@tonic-gate * NGROUPS_MAX_DEFAULT: *MUST* match NGROUPS_MAX value in limits.h. 1267c478bd9Sstevel@tonic-gate * Remember that the NFS protocol must rev. before this can be increased 1277c478bd9Sstevel@tonic-gate */ 1287c478bd9Sstevel@tonic-gate #define NGROUPS_MAX_DEFAULT 16 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /* 1317c478bd9Sstevel@tonic-gate * Default process priority. Keep it in sync with limits.h. 1327c478bd9Sstevel@tonic-gate */ 1337c478bd9Sstevel@tonic-gate #define NZERO 20 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* 1367c478bd9Sstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily. 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #ifndef NULL 1427c478bd9Sstevel@tonic-gate #if defined(_LP64) 1437c478bd9Sstevel@tonic-gate #define NULL 0L 1447c478bd9Sstevel@tonic-gate #else 1457c478bd9Sstevel@tonic-gate #define NULL 0 1467c478bd9Sstevel@tonic-gate #endif 1477c478bd9Sstevel@tonic-gate #endif 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate #define CMASK 022 /* default mask for file creation */ 1507c478bd9Sstevel@tonic-gate #define CDLIMIT (1L<<11) /* default max write address */ 1517c478bd9Sstevel@tonic-gate #define NBPS 0x20000 /* Number of bytes per segment */ 1527c478bd9Sstevel@tonic-gate #define NBPSCTR 512 /* Bytes per disk sector. */ 1537c478bd9Sstevel@tonic-gate #define UBSIZE 512 /* unix block size. */ 1547c478bd9Sstevel@tonic-gate #define SCTRSHFT 9 /* Shift for BPSECT. */ 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate #ifdef _LITTLE_ENDIAN 1577c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[0]) 1587c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[1]) 1597c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[0]) 1607c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[1]) 1617c478bd9Sstevel@tonic-gate #endif 1627c478bd9Sstevel@tonic-gate #ifdef _BIG_ENDIAN 1637c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[1]) 1647c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[0]) 1657c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[1]) 1667c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[0]) 1677c478bd9Sstevel@tonic-gate #endif 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /* REMOTE -- whether machine is primary, secondary, or regular */ 1707c478bd9Sstevel@tonic-gate #define SYSNAME 9 /* # chars in system name */ 1717c478bd9Sstevel@tonic-gate #define PREMOTE 39 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length, 1757c478bd9Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 1767c478bd9Sstevel@tonic-gate * TYPICALMAXPATHLEN is used in a few places as an optimization 1777c478bd9Sstevel@tonic-gate * with a local buffer on the stack to avoid kmem_alloc(). 1787c478bd9Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 1797c478bd9Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 1807c478bd9Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 1817c478bd9Sstevel@tonic-gate * reasonably quickly. 1827c478bd9Sstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of 1837c478bd9Sstevel@tonic-gate * the longest permissible file (component) name. 1847c478bd9Sstevel@tonic-gate */ 1857c478bd9Sstevel@tonic-gate #define MAXPATHLEN 1024 1867c478bd9Sstevel@tonic-gate #define TYPICALMAXPATHLEN 64 1877c478bd9Sstevel@tonic-gate #define MAXSYMLINKS 20 1887c478bd9Sstevel@tonic-gate #define MAXNAMELEN 256 1897c478bd9Sstevel@tonic-gate 190d62bc4baSyz /* 191d62bc4baSyz * MAXLINKNAMELEN defines the longest possible permitted datalink name, 192d62bc4baSyz * including the terminating NUL. Note that this must not be larger 193d62bc4baSyz * than related networking constants such as LIFNAMSIZ. 194d62bc4baSyz */ 195d62bc4baSyz #define MAXLINKNAMELEN 32 196d62bc4baSyz 1977c478bd9Sstevel@tonic-gate #ifndef NADDR 1987c478bd9Sstevel@tonic-gate #define NADDR 13 1997c478bd9Sstevel@tonic-gate #endif 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gate /* 2027c478bd9Sstevel@tonic-gate * The following are defined to be the same as 2037c478bd9Sstevel@tonic-gate * defined in /usr/include/limits.h. They are 2047c478bd9Sstevel@tonic-gate * needed for pipe and FIFO compatibility. 2057c478bd9Sstevel@tonic-gate */ 2067c478bd9Sstevel@tonic-gate #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ 2077c478bd9Sstevel@tonic-gate #define PIPE_BUF 5120 2087c478bd9Sstevel@tonic-gate #endif /* PIPE_BUF */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ 2117c478bd9Sstevel@tonic-gate #define PIPE_MAX 5120 2127c478bd9Sstevel@tonic-gate #endif /* PIPE_MAX */ 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate #ifndef NBBY 2157c478bd9Sstevel@tonic-gate #define NBBY 8 /* number of bits per byte */ 2167c478bd9Sstevel@tonic-gate #endif 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate /* macros replacing interleaving functions */ 2197c478bd9Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 2207c478bd9Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate /* 2237c478bd9Sstevel@tonic-gate * File system parameters and macros. 2247c478bd9Sstevel@tonic-gate * 2257c478bd9Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 2267c478bd9Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 2277c478bd9Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 2287c478bd9Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 2297c478bd9Sstevel@tonic-gate * file systems; however making it smaller make make some file 2307c478bd9Sstevel@tonic-gate * systems unmountable. 2317c478bd9Sstevel@tonic-gate * 2327c478bd9Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 2337c478bd9Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 2347c478bd9Sstevel@tonic-gate */ 2357c478bd9Sstevel@tonic-gate #define MAXBSIZE 8192 2367c478bd9Sstevel@tonic-gate #define DEV_BSIZE 512 2377c478bd9Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 2387c478bd9Sstevel@tonic-gate #define MAXFRAG 8 2397c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2407c478bd9Sstevel@tonic-gate #define MAXOFF32_T 0x7fffffff 2417c478bd9Sstevel@tonic-gate #endif 2427c478bd9Sstevel@tonic-gate #ifdef _LP64 2437c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffffffffffl 2447c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffl 2457c478bd9Sstevel@tonic-gate #else 2467c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffl 2477c478bd9Sstevel@tonic-gate #ifdef _LONGLONG_TYPE 2487c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffLL 2497c478bd9Sstevel@tonic-gate #else 2507c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffff 2517c478bd9Sstevel@tonic-gate #endif 2527c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2557c478bd9Sstevel@tonic-gate ((unsigned long)(bytes) >> DEV_BSHIFT) 2567c478bd9Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2577c478bd9Sstevel@tonic-gate ((unsigned long)(db) << DEV_BSHIFT) 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate /* 64 bit versions of btodb and dbtob */ 2607c478bd9Sstevel@tonic-gate #define lbtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2617c478bd9Sstevel@tonic-gate ((u_offset_t)(bytes) >> DEV_BSHIFT) 2627c478bd9Sstevel@tonic-gate #define ldbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2637c478bd9Sstevel@tonic-gate ((u_offset_t)(db) << DEV_BSHIFT) 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 2667c478bd9Sstevel@tonic-gate #ifndef NODEV 2677c478bd9Sstevel@tonic-gate #define NODEV (dev_t)(-1l) 2687c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2697c478bd9Sstevel@tonic-gate #define NODEV32 (dev32_t)(-1) 2707c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2717c478bd9Sstevel@tonic-gate #endif /* NODEV */ 2727c478bd9Sstevel@tonic-gate #endif /* _ASM */ 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate /* 2757c478bd9Sstevel@tonic-gate * Size of arg list passed in by user. 2767c478bd9Sstevel@tonic-gate */ 2777c478bd9Sstevel@tonic-gate #define NCARGS32 0x100000 2787c478bd9Sstevel@tonic-gate #define NCARGS64 0x200000 2797c478bd9Sstevel@tonic-gate #ifdef _LP64 2807c478bd9Sstevel@tonic-gate #define NCARGS NCARGS64 2817c478bd9Sstevel@tonic-gate #else /* _LP64 */ 2827c478bd9Sstevel@tonic-gate #define NCARGS NCARGS32 2837c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate /* 2867c478bd9Sstevel@tonic-gate * Scale factor for scaled integers used to count 2877c478bd9Sstevel@tonic-gate * %cpu time and load averages. 2887c478bd9Sstevel@tonic-gate */ 2897c478bd9Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 2907c478bd9Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate /* 2937c478bd9Sstevel@tonic-gate * Delay units are in microseconds. 2947c478bd9Sstevel@tonic-gate * 2957c478bd9Sstevel@tonic-gate * XXX These macros are not part of the DDI! 2967c478bd9Sstevel@tonic-gate */ 2977c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 2987c478bd9Sstevel@tonic-gate extern void drv_usecwait(clock_t); 2997c478bd9Sstevel@tonic-gate #define DELAY(n) drv_usecwait(n) 3007c478bd9Sstevel@tonic-gate #define CDELAY(c, n) \ 3017c478bd9Sstevel@tonic-gate { \ 3027c478bd9Sstevel@tonic-gate register int N = n; \ 3037c478bd9Sstevel@tonic-gate while (--N > 0) { \ 3047c478bd9Sstevel@tonic-gate if (c) \ 3057c478bd9Sstevel@tonic-gate break; \ 3067c478bd9Sstevel@tonic-gate drv_usecwait(1); \ 3077c478bd9Sstevel@tonic-gate } \ 3087c478bd9Sstevel@tonic-gate } 3097c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3127c478bd9Sstevel@tonic-gate } 3137c478bd9Sstevel@tonic-gate #endif 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate /* 3167c478bd9Sstevel@tonic-gate * The following is to free utilities from machine dependencies within 3177c478bd9Sstevel@tonic-gate * an architecture. Must be included after definition of DEV_BSIZE. 3187c478bd9Sstevel@tonic-gate */ 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate #if defined(_MACHDEP) 3237c478bd9Sstevel@tonic-gate #include <sys/machparam.h> 3247c478bd9Sstevel@tonic-gate #endif 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3277c478bd9Sstevel@tonic-gate extern "C" { 3287c478bd9Sstevel@tonic-gate #endif 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3317c478bd9Sstevel@tonic-gate extern int cpu_decay_factor; 3327c478bd9Sstevel@tonic-gate extern pid_t maxpid; 3337c478bd9Sstevel@tonic-gate extern pid_t jump_pid; 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate extern uintptr_t _kernelbase; 3367c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit; 3377c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit32; 3387c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3397c478bd9Sstevel@tonic-gate 340*8793b36bSNick Todd /* 341*8793b36bSNick Todd * These three variables have been added within the #if defined(lint) 342*8793b36bSNick Todd * below to ensure visibility to lint. This is a short term workaround 343*8793b36bSNick Todd * to handle poor interaction between SS12 lint and these variables. 344*8793b36bSNick Todd * CR 6742611 has been logged to address these issues. 345*8793b36bSNick Todd */ 346*8793b36bSNick Todd #if defined(lint) 347*8793b36bSNick Todd extern int snooping; 348*8793b36bSNick Todd extern uint_t snoop_interval; 349*8793b36bSNick Todd extern const unsigned int _pageshift; 350*8793b36bSNick Todd #endif /* lint */ 3517c478bd9Sstevel@tonic-gate 3527c478bd9Sstevel@tonic-gate #if !defined(_MACHDEP) 3537c478bd9Sstevel@tonic-gate 3547c478bd9Sstevel@tonic-gate /* 3557c478bd9Sstevel@tonic-gate * Implementation architecture independent sections of the kernel use 3567c478bd9Sstevel@tonic-gate * this section. 3577c478bd9Sstevel@tonic-gate */ 3587c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3597c478bd9Sstevel@tonic-gate extern int hz; 3607c478bd9Sstevel@tonic-gate extern int snooping; 3617c478bd9Sstevel@tonic-gate extern uint_t snoop_interval; 3627c478bd9Sstevel@tonic-gate extern const unsigned long _pagesize; 3637c478bd9Sstevel@tonic-gate extern const unsigned int _pageshift; 3647c478bd9Sstevel@tonic-gate extern const unsigned long _pageoffset; 3657c478bd9Sstevel@tonic-gate extern const unsigned long long _pagemask; 3667c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagesize; 3677c478bd9Sstevel@tonic-gate extern const unsigned int _mmu_pageshift; 3687c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pageoffset; 3697c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagemask; 3707c478bd9Sstevel@tonic-gate extern const uintptr_t _argsbase; 3717c478bd9Sstevel@tonic-gate extern const unsigned long _defaultstksz; 3727c478bd9Sstevel@tonic-gate extern const unsigned int _nbpg; 3737c478bd9Sstevel@tonic-gate extern const int _ncpu; 3747c478bd9Sstevel@tonic-gate extern const int _clsize; 3757c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3767c478bd9Sstevel@tonic-gate 3777c478bd9Sstevel@tonic-gate #define PAGESIZE _pagesize 3787c478bd9Sstevel@tonic-gate #define PAGESHIFT _pageshift 3797c478bd9Sstevel@tonic-gate #define PAGEOFFSET _pageoffset 3807c478bd9Sstevel@tonic-gate #define PAGEMASK _pagemask 3817c478bd9Sstevel@tonic-gate #define MMU_PAGESIZE _mmu_pagesize 3827c478bd9Sstevel@tonic-gate #define MMU_PAGESHIFT _mmu_pageshift 3837c478bd9Sstevel@tonic-gate #define MMU_PAGEOFFSET _mmu_pageoffset 3847c478bd9Sstevel@tonic-gate #define MMU_PAGEMASK _mmu_pagemask 3857c478bd9Sstevel@tonic-gate 3867c478bd9Sstevel@tonic-gate #define KERNELBASE _kernelbase 3877c478bd9Sstevel@tonic-gate #define USERLIMIT _userlimit 3887c478bd9Sstevel@tonic-gate #define USERLIMIT32 _userlimit32 3897c478bd9Sstevel@tonic-gate #define ARGSBASE _argsbase 3907c478bd9Sstevel@tonic-gate #define DEFAULTSTKSZ _defaultstksz 3917c478bd9Sstevel@tonic-gate #define NCPU _ncpu 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate #endif /* defined(_MACHDEP) */ 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate /* 3967c478bd9Sstevel@tonic-gate * Some random macros for units conversion. 3977c478bd9Sstevel@tonic-gate * 3987c478bd9Sstevel@tonic-gate * These are machine independent but contain constants (*PAGESHIFT) which 3997c478bd9Sstevel@tonic-gate * are only defined in the machine dependent file. 4007c478bd9Sstevel@tonic-gate */ 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate /* 4037c478bd9Sstevel@tonic-gate * MMU pages to bytes, and back (with and without rounding) 4047c478bd9Sstevel@tonic-gate */ 4057c478bd9Sstevel@tonic-gate #define mmu_ptob(x) ((x) << MMU_PAGESHIFT) 4067c478bd9Sstevel@tonic-gate #define mmu_btop(x) (((x)) >> MMU_PAGESHIFT) 4077c478bd9Sstevel@tonic-gate #define mmu_btopr(x) ((((x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate /* 4107c478bd9Sstevel@tonic-gate * 2 versions of pages to disk blocks 4117c478bd9Sstevel@tonic-gate */ 4127c478bd9Sstevel@tonic-gate #define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) 4137c478bd9Sstevel@tonic-gate #define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate /* 4167c478bd9Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 4177c478bd9Sstevel@tonic-gate * Large Files: The explicit cast of x to unsigned int is deliberately 4187c478bd9Sstevel@tonic-gate * removed as part of large files work. We pass longlong values to 4197c478bd9Sstevel@tonic-gate * theses macros. 4207c478bd9Sstevel@tonic-gate * 4217c478bd9Sstevel@tonic-gate * Cast the input to ptob() to be a page count. This enforces 64-bit 4227c478bd9Sstevel@tonic-gate * math on 64-bit kernels. For 32-bit kernels, callers must explicitly 4237c478bd9Sstevel@tonic-gate * cast the input to be a 64-bit type if values greater than 4GB/PAGESIZE 4247c478bd9Sstevel@tonic-gate * are possible. 4257c478bd9Sstevel@tonic-gate */ 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate #ifdef _LP64 4287c478bd9Sstevel@tonic-gate #define ptob(x) (((pgcnt_t)(x)) << PAGESHIFT) 4297c478bd9Sstevel@tonic-gate #else 4307c478bd9Sstevel@tonic-gate #define ptob(x) ((x) << PAGESHIFT) 4317c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4327c478bd9Sstevel@tonic-gate #define btop(x) (((x) >> PAGESHIFT)) 4337c478bd9Sstevel@tonic-gate #define btopr(x) ((((x) + PAGEOFFSET) >> PAGESHIFT)) 4347c478bd9Sstevel@tonic-gate 4357c478bd9Sstevel@tonic-gate /* 4367c478bd9Sstevel@tonic-gate * disk blocks to pages, rounded and truncated 4377c478bd9Sstevel@tonic-gate */ 4387c478bd9Sstevel@tonic-gate #define NDPP (PAGESIZE/DEV_BSIZE) /* # of disk blocks per page */ 4397c478bd9Sstevel@tonic-gate #define dtop(DD) (((DD) + NDPP - 1) >> (PAGESHIFT - DEV_BSHIFT)) 4407c478bd9Sstevel@tonic-gate #define dtopt(DD) ((DD) >> (PAGESHIFT - DEV_BSHIFT)) 4417c478bd9Sstevel@tonic-gate 442ae115bc7Smrj /* 443ae115bc7Smrj * kB to pages and back 444ae115bc7Smrj */ 445ae115bc7Smrj #define kbtop(x) ((x) >> (PAGESHIFT - 10)) 446ae115bc7Smrj #define ptokb(x) ((x) << (PAGESHIFT - 10)) 447ae115bc7Smrj 4487c478bd9Sstevel@tonic-gate /* 4497c478bd9Sstevel@tonic-gate * POSIX.4 related configuration parameters 4507c478bd9Sstevel@tonic-gate */ 4517c478bd9Sstevel@tonic-gate #define _AIO_LISTIO_MAX (4096) 4527c478bd9Sstevel@tonic-gate #define _AIO_MAX (-1) 45306a502e8Scasper #define _MQ_OPEN_MAX (-1) 4547c478bd9Sstevel@tonic-gate #define _MQ_PRIO_MAX (32) 4557c478bd9Sstevel@tonic-gate #define _SEM_NSEMS_MAX INT_MAX 4567c478bd9Sstevel@tonic-gate #define _SEM_VALUE_MAX INT_MAX 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4597c478bd9Sstevel@tonic-gate } 4607c478bd9Sstevel@tonic-gate #endif 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gate #else /* (defined(_KERNEL) || defined(_KMEMUSER)) */ 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate /* 4657c478bd9Sstevel@tonic-gate * The following are assorted machine dependent values which can be 4667c478bd9Sstevel@tonic-gate * obtained in a machine independent manner through sysconf(2) or 4677c478bd9Sstevel@tonic-gate * sysinfo(2). In order to guarantee that these provide the expected 4687c478bd9Sstevel@tonic-gate * value at all times, the System Private interface (leading underscore) 4697c478bd9Sstevel@tonic-gate * is used. 4707c478bd9Sstevel@tonic-gate */ 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate #include <sys/unistd.h> 4737c478bd9Sstevel@tonic-gate 4747c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4757c478bd9Sstevel@tonic-gate extern "C" { 4767c478bd9Sstevel@tonic-gate #endif 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate #if !defined(_ASM) 4797c478bd9Sstevel@tonic-gate extern long _sysconf(int); /* System Private interface to sysconf() */ 4807c478bd9Sstevel@tonic-gate #endif /* !defined(_ASM) */ 4817c478bd9Sstevel@tonic-gate 4827c478bd9Sstevel@tonic-gate #define HZ ((clock_t)_sysconf(_SC_CLK_TCK)) 4837c478bd9Sstevel@tonic-gate #define TICK (1000000000/((clock_t)_sysconf(_SC_CLK_TCK))) 4847c478bd9Sstevel@tonic-gate #define PAGESIZE (_sysconf(_SC_PAGESIZE)) 4857c478bd9Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 4867c478bd9Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 4877c478bd9Sstevel@tonic-gate #define MAXPID ((pid_t)_sysconf(_SC_MAXPID)) 488f48205beScasper #define MAXEPHUID ((uid_t)_sysconf(_SC_EPHID_MAX)) 4897c478bd9Sstevel@tonic-gate 4907c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4917c478bd9Sstevel@tonic-gate } 4927c478bd9Sstevel@tonic-gate #endif 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate #endif /* (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP) */ 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate #endif /* _SYS_PARAM_H */ 497