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 /* 22ae115bc7Smrj * Copyright 2007 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 #pragma ident "%Z%%M% %I% %E% SMI" 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 457c478bd9Sstevel@tonic-gate #include <sys/types.h> 467c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 477c478bd9Sstevel@tonic-gate #endif /* _ASM */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #ifdef __cplusplus 517c478bd9Sstevel@tonic-gate extern "C" { 527c478bd9Sstevel@tonic-gate #endif 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* 557c478bd9Sstevel@tonic-gate * Fundamental variables; don't change too often. 567c478bd9Sstevel@tonic-gate */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * _POSIX_VDISABLE has historically been defined in <sys/param.h> since 607c478bd9Sstevel@tonic-gate * an early merge with AT&T source. It has also historically been defined 617c478bd9Sstevel@tonic-gate * in <sys/termios.h>. The POSIX standard, IEEE Std. 1003.1-1988 initially 627c478bd9Sstevel@tonic-gate * required the existence of _POSIX_VDISABLE in <sys/termios.h>. 637c478bd9Sstevel@tonic-gate * Subsequent versions of the IEEE Standard as well as the X/Open 647c478bd9Sstevel@tonic-gate * specifications required that _POSIX_VDISABLE be defined in <unistd.h> 657c478bd9Sstevel@tonic-gate * while still allowing for it's existence in other headers. With the 667c478bd9Sstevel@tonic-gate * introduction of XPG6, _POSIX_VDISABLE can only be defined in <unistd.h>. 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 697c478bd9Sstevel@tonic-gate #ifndef _POSIX_VDISABLE 707c478bd9Sstevel@tonic-gate #define _POSIX_VDISABLE 0 /* Disable special character functions */ 717c478bd9Sstevel@tonic-gate #endif 727c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #ifndef MAX_INPUT 757c478bd9Sstevel@tonic-gate #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ 767c478bd9Sstevel@tonic-gate #endif 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate #ifndef MAX_CANON 797c478bd9Sstevel@tonic-gate #define MAX_CANON 256 /* Maximum bytes for canonical processing */ 807c478bd9Sstevel@tonic-gate #endif 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define UID_NOBODY 60001 /* user ID no body */ 837c478bd9Sstevel@tonic-gate #define GID_NOBODY UID_NOBODY 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate #define UID_NOACCESS 60002 /* user ID no access */ 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #ifdef _KERNEL 887c478bd9Sstevel@tonic-gate #define MAX_TASKID 999999 897c478bd9Sstevel@tonic-gate #define MAX_MAXPID 999999 90*f48205beScasper #define MAXEPHUID 0xfffffffcu /* max ephemeral user id */ 917c478bd9Sstevel@tonic-gate #endif 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #ifdef DEBUG 947c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 999999 957c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 100000 967c478bd9Sstevel@tonic-gate #else 977c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 30000 987c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 0 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #endif 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate #define MAXUID 2147483647 /* max user id */ 103*f48205beScasper 1047c478bd9Sstevel@tonic-gate #define MAXPROJID MAXUID /* max project id */ 1057c478bd9Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 1067c478bd9Sstevel@tonic-gate 107*f48205beScasper #define MINEPHUID 0x80000000u /* min ephemeral user id */ 108*f48205beScasper 1097c478bd9Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #define CANBSIZ 256 /* max size of typewriter line */ 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate #define NOFILE 20 /* this define is here for */ 1147c478bd9Sstevel@tonic-gate /* compatibility purposes only */ 1157c478bd9Sstevel@tonic-gate /* and will be removed in a */ 1167c478bd9Sstevel@tonic-gate /* later release */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * These define the maximum and minimum allowable values of the 1207c478bd9Sstevel@tonic-gate * configurable parameter NGROUPS_MAX. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate #define NGROUPS_UMIN 0 1237c478bd9Sstevel@tonic-gate #define NGROUPS_UMAX 32 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* 1267c478bd9Sstevel@tonic-gate * NGROUPS_MAX_DEFAULT: *MUST* match NGROUPS_MAX value in limits.h. 1277c478bd9Sstevel@tonic-gate * Remember that the NFS protocol must rev. before this can be increased 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate #define NGROUPS_MAX_DEFAULT 16 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * Default process priority. Keep it in sync with limits.h. 1337c478bd9Sstevel@tonic-gate */ 1347c478bd9Sstevel@tonic-gate #define NZERO 20 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily. 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #ifndef NULL 1437c478bd9Sstevel@tonic-gate #if defined(_LP64) 1447c478bd9Sstevel@tonic-gate #define NULL 0L 1457c478bd9Sstevel@tonic-gate #else 1467c478bd9Sstevel@tonic-gate #define NULL 0 1477c478bd9Sstevel@tonic-gate #endif 1487c478bd9Sstevel@tonic-gate #endif 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #define CMASK 022 /* default mask for file creation */ 1517c478bd9Sstevel@tonic-gate #define CDLIMIT (1L<<11) /* default max write address */ 1527c478bd9Sstevel@tonic-gate #define NBPS 0x20000 /* Number of bytes per segment */ 1537c478bd9Sstevel@tonic-gate #define NBPSCTR 512 /* Bytes per disk sector. */ 1547c478bd9Sstevel@tonic-gate #define UBSIZE 512 /* unix block size. */ 1557c478bd9Sstevel@tonic-gate #define SCTRSHFT 9 /* Shift for BPSECT. */ 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate #ifdef _LITTLE_ENDIAN 1587c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[0]) 1597c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[1]) 1607c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[0]) 1617c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[1]) 1627c478bd9Sstevel@tonic-gate #endif 1637c478bd9Sstevel@tonic-gate #ifdef _BIG_ENDIAN 1647c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[1]) 1657c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[0]) 1667c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[1]) 1677c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[0]) 1687c478bd9Sstevel@tonic-gate #endif 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate /* REMOTE -- whether machine is primary, secondary, or regular */ 1717c478bd9Sstevel@tonic-gate #define SYSNAME 9 /* # chars in system name */ 1727c478bd9Sstevel@tonic-gate #define PREMOTE 39 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate /* 1757c478bd9Sstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length, 1767c478bd9Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 1777c478bd9Sstevel@tonic-gate * TYPICALMAXPATHLEN is used in a few places as an optimization 1787c478bd9Sstevel@tonic-gate * with a local buffer on the stack to avoid kmem_alloc(). 1797c478bd9Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 1807c478bd9Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 1817c478bd9Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 1827c478bd9Sstevel@tonic-gate * reasonably quickly. 1837c478bd9Sstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of 1847c478bd9Sstevel@tonic-gate * the longest permissible file (component) name. 1857c478bd9Sstevel@tonic-gate */ 1867c478bd9Sstevel@tonic-gate #define MAXPATHLEN 1024 1877c478bd9Sstevel@tonic-gate #define TYPICALMAXPATHLEN 64 1887c478bd9Sstevel@tonic-gate #define MAXSYMLINKS 20 1897c478bd9Sstevel@tonic-gate #define MAXNAMELEN 256 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate #ifndef NADDR 1927c478bd9Sstevel@tonic-gate #define NADDR 13 1937c478bd9Sstevel@tonic-gate #endif 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate /* 1967c478bd9Sstevel@tonic-gate * The following are defined to be the same as 1977c478bd9Sstevel@tonic-gate * defined in /usr/include/limits.h. They are 1987c478bd9Sstevel@tonic-gate * needed for pipe and FIFO compatibility. 1997c478bd9Sstevel@tonic-gate */ 2007c478bd9Sstevel@tonic-gate #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ 2017c478bd9Sstevel@tonic-gate #define PIPE_BUF 5120 2027c478bd9Sstevel@tonic-gate #endif /* PIPE_BUF */ 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ 2057c478bd9Sstevel@tonic-gate #define PIPE_MAX 5120 2067c478bd9Sstevel@tonic-gate #endif /* PIPE_MAX */ 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate #ifndef NBBY 2097c478bd9Sstevel@tonic-gate #define NBBY 8 /* number of bits per byte */ 2107c478bd9Sstevel@tonic-gate #endif 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate /* macros replacing interleaving functions */ 2137c478bd9Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 2147c478bd9Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* 2177c478bd9Sstevel@tonic-gate * File system parameters and macros. 2187c478bd9Sstevel@tonic-gate * 2197c478bd9Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 2207c478bd9Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 2217c478bd9Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 2227c478bd9Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 2237c478bd9Sstevel@tonic-gate * file systems; however making it smaller make make some file 2247c478bd9Sstevel@tonic-gate * systems unmountable. 2257c478bd9Sstevel@tonic-gate * 2267c478bd9Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 2277c478bd9Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 2287c478bd9Sstevel@tonic-gate */ 2297c478bd9Sstevel@tonic-gate #define MAXBSIZE 8192 2307c478bd9Sstevel@tonic-gate #define DEV_BSIZE 512 2317c478bd9Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 2327c478bd9Sstevel@tonic-gate #define MAXFRAG 8 2337c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2347c478bd9Sstevel@tonic-gate #define MAXOFF32_T 0x7fffffff 2357c478bd9Sstevel@tonic-gate #endif 2367c478bd9Sstevel@tonic-gate #ifdef _LP64 2377c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffffffffffl 2387c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffl 2397c478bd9Sstevel@tonic-gate #else 2407c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffl 2417c478bd9Sstevel@tonic-gate #ifdef _LONGLONG_TYPE 2427c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffLL 2437c478bd9Sstevel@tonic-gate #else 2447c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffff 2457c478bd9Sstevel@tonic-gate #endif 2467c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2497c478bd9Sstevel@tonic-gate ((unsigned long)(bytes) >> DEV_BSHIFT) 2507c478bd9Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2517c478bd9Sstevel@tonic-gate ((unsigned long)(db) << DEV_BSHIFT) 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* 64 bit versions of btodb and dbtob */ 2547c478bd9Sstevel@tonic-gate #define lbtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2557c478bd9Sstevel@tonic-gate ((u_offset_t)(bytes) >> DEV_BSHIFT) 2567c478bd9Sstevel@tonic-gate #define ldbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2577c478bd9Sstevel@tonic-gate ((u_offset_t)(db) << DEV_BSHIFT) 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 2607c478bd9Sstevel@tonic-gate #ifndef NODEV 2617c478bd9Sstevel@tonic-gate #define NODEV (dev_t)(-1l) 2627c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2637c478bd9Sstevel@tonic-gate #define NODEV32 (dev32_t)(-1) 2647c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2657c478bd9Sstevel@tonic-gate #endif /* NODEV */ 2667c478bd9Sstevel@tonic-gate #endif /* _ASM */ 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* 2697c478bd9Sstevel@tonic-gate * Size of arg list passed in by user. 2707c478bd9Sstevel@tonic-gate */ 2717c478bd9Sstevel@tonic-gate #define NCARGS32 0x100000 2727c478bd9Sstevel@tonic-gate #define NCARGS64 0x200000 2737c478bd9Sstevel@tonic-gate #ifdef _LP64 2747c478bd9Sstevel@tonic-gate #define NCARGS NCARGS64 2757c478bd9Sstevel@tonic-gate #else /* _LP64 */ 2767c478bd9Sstevel@tonic-gate #define NCARGS NCARGS32 2777c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate /* 2807c478bd9Sstevel@tonic-gate * Scale factor for scaled integers used to count 2817c478bd9Sstevel@tonic-gate * %cpu time and load averages. 2827c478bd9Sstevel@tonic-gate */ 2837c478bd9Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 2847c478bd9Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 2857c478bd9Sstevel@tonic-gate 2867c478bd9Sstevel@tonic-gate /* 2877c478bd9Sstevel@tonic-gate * Delay units are in microseconds. 2887c478bd9Sstevel@tonic-gate * 2897c478bd9Sstevel@tonic-gate * XXX These macros are not part of the DDI! 2907c478bd9Sstevel@tonic-gate */ 2917c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 2927c478bd9Sstevel@tonic-gate extern void drv_usecwait(clock_t); 2937c478bd9Sstevel@tonic-gate #define DELAY(n) drv_usecwait(n) 2947c478bd9Sstevel@tonic-gate #define CDELAY(c, n) \ 2957c478bd9Sstevel@tonic-gate { \ 2967c478bd9Sstevel@tonic-gate register int N = n; \ 2977c478bd9Sstevel@tonic-gate while (--N > 0) { \ 2987c478bd9Sstevel@tonic-gate if (c) \ 2997c478bd9Sstevel@tonic-gate break; \ 3007c478bd9Sstevel@tonic-gate drv_usecwait(1); \ 3017c478bd9Sstevel@tonic-gate } \ 3027c478bd9Sstevel@tonic-gate } 3037c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3067c478bd9Sstevel@tonic-gate } 3077c478bd9Sstevel@tonic-gate #endif 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate /* 3107c478bd9Sstevel@tonic-gate * The following is to free utilities from machine dependencies within 3117c478bd9Sstevel@tonic-gate * an architecture. Must be included after definition of DEV_BSIZE. 3127c478bd9Sstevel@tonic-gate */ 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate #if defined(_MACHDEP) 3177c478bd9Sstevel@tonic-gate #include <sys/machparam.h> 3187c478bd9Sstevel@tonic-gate #endif 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3217c478bd9Sstevel@tonic-gate extern "C" { 3227c478bd9Sstevel@tonic-gate #endif 3237c478bd9Sstevel@tonic-gate 3247c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3257c478bd9Sstevel@tonic-gate extern int cpu_decay_factor; 3267c478bd9Sstevel@tonic-gate extern pid_t maxpid; 3277c478bd9Sstevel@tonic-gate extern pid_t jump_pid; 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate extern uintptr_t _kernelbase; 3307c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit; 3317c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit32; 3327c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3337c478bd9Sstevel@tonic-gate 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate #if !defined(_MACHDEP) 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate /* 3387c478bd9Sstevel@tonic-gate * Implementation architecture independent sections of the kernel use 3397c478bd9Sstevel@tonic-gate * this section. 3407c478bd9Sstevel@tonic-gate */ 3417c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3427c478bd9Sstevel@tonic-gate extern int hz; 3437c478bd9Sstevel@tonic-gate extern int snooping; 3447c478bd9Sstevel@tonic-gate extern uint_t snoop_interval; 3457c478bd9Sstevel@tonic-gate extern const unsigned long _pagesize; 3467c478bd9Sstevel@tonic-gate extern const unsigned int _pageshift; 3477c478bd9Sstevel@tonic-gate extern const unsigned long _pageoffset; 3487c478bd9Sstevel@tonic-gate extern const unsigned long long _pagemask; 3497c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagesize; 3507c478bd9Sstevel@tonic-gate extern const unsigned int _mmu_pageshift; 3517c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pageoffset; 3527c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagemask; 3537c478bd9Sstevel@tonic-gate extern const uintptr_t _argsbase; 3547c478bd9Sstevel@tonic-gate extern const unsigned long _defaultstksz; 3557c478bd9Sstevel@tonic-gate extern const unsigned int _nbpg; 3567c478bd9Sstevel@tonic-gate extern const int _ncpu; 3577c478bd9Sstevel@tonic-gate extern const int _clsize; 3587c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate #define PAGESIZE _pagesize 3617c478bd9Sstevel@tonic-gate #define PAGESHIFT _pageshift 3627c478bd9Sstevel@tonic-gate #define PAGEOFFSET _pageoffset 3637c478bd9Sstevel@tonic-gate #define PAGEMASK _pagemask 3647c478bd9Sstevel@tonic-gate #define MMU_PAGESIZE _mmu_pagesize 3657c478bd9Sstevel@tonic-gate #define MMU_PAGESHIFT _mmu_pageshift 3667c478bd9Sstevel@tonic-gate #define MMU_PAGEOFFSET _mmu_pageoffset 3677c478bd9Sstevel@tonic-gate #define MMU_PAGEMASK _mmu_pagemask 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate #define KERNELBASE _kernelbase 3707c478bd9Sstevel@tonic-gate #define USERLIMIT _userlimit 3717c478bd9Sstevel@tonic-gate #define USERLIMIT32 _userlimit32 3727c478bd9Sstevel@tonic-gate #define ARGSBASE _argsbase 3737c478bd9Sstevel@tonic-gate #define DEFAULTSTKSZ _defaultstksz 3747c478bd9Sstevel@tonic-gate #define NCPU _ncpu 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate #endif /* defined(_MACHDEP) */ 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate /* 3797c478bd9Sstevel@tonic-gate * Some random macros for units conversion. 3807c478bd9Sstevel@tonic-gate * 3817c478bd9Sstevel@tonic-gate * These are machine independent but contain constants (*PAGESHIFT) which 3827c478bd9Sstevel@tonic-gate * are only defined in the machine dependent file. 3837c478bd9Sstevel@tonic-gate */ 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate /* 3867c478bd9Sstevel@tonic-gate * MMU pages to bytes, and back (with and without rounding) 3877c478bd9Sstevel@tonic-gate */ 3887c478bd9Sstevel@tonic-gate #define mmu_ptob(x) ((x) << MMU_PAGESHIFT) 3897c478bd9Sstevel@tonic-gate #define mmu_btop(x) (((x)) >> MMU_PAGESHIFT) 3907c478bd9Sstevel@tonic-gate #define mmu_btopr(x) ((((x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate /* 3937c478bd9Sstevel@tonic-gate * 2 versions of pages to disk blocks 3947c478bd9Sstevel@tonic-gate */ 3957c478bd9Sstevel@tonic-gate #define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) 3967c478bd9Sstevel@tonic-gate #define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) 3977c478bd9Sstevel@tonic-gate 3987c478bd9Sstevel@tonic-gate /* 3997c478bd9Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 4007c478bd9Sstevel@tonic-gate * Large Files: The explicit cast of x to unsigned int is deliberately 4017c478bd9Sstevel@tonic-gate * removed as part of large files work. We pass longlong values to 4027c478bd9Sstevel@tonic-gate * theses macros. 4037c478bd9Sstevel@tonic-gate * 4047c478bd9Sstevel@tonic-gate * Cast the input to ptob() to be a page count. This enforces 64-bit 4057c478bd9Sstevel@tonic-gate * math on 64-bit kernels. For 32-bit kernels, callers must explicitly 4067c478bd9Sstevel@tonic-gate * cast the input to be a 64-bit type if values greater than 4GB/PAGESIZE 4077c478bd9Sstevel@tonic-gate * are possible. 4087c478bd9Sstevel@tonic-gate */ 4097c478bd9Sstevel@tonic-gate 4107c478bd9Sstevel@tonic-gate #ifdef _LP64 4117c478bd9Sstevel@tonic-gate #define ptob(x) (((pgcnt_t)(x)) << PAGESHIFT) 4127c478bd9Sstevel@tonic-gate #else 4137c478bd9Sstevel@tonic-gate #define ptob(x) ((x) << PAGESHIFT) 4147c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4157c478bd9Sstevel@tonic-gate #define btop(x) (((x) >> PAGESHIFT)) 4167c478bd9Sstevel@tonic-gate #define btopr(x) ((((x) + PAGEOFFSET) >> PAGESHIFT)) 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* 4197c478bd9Sstevel@tonic-gate * disk blocks to pages, rounded and truncated 4207c478bd9Sstevel@tonic-gate */ 4217c478bd9Sstevel@tonic-gate #define NDPP (PAGESIZE/DEV_BSIZE) /* # of disk blocks per page */ 4227c478bd9Sstevel@tonic-gate #define dtop(DD) (((DD) + NDPP - 1) >> (PAGESHIFT - DEV_BSHIFT)) 4237c478bd9Sstevel@tonic-gate #define dtopt(DD) ((DD) >> (PAGESHIFT - DEV_BSHIFT)) 4247c478bd9Sstevel@tonic-gate 425ae115bc7Smrj /* 426ae115bc7Smrj * kB to pages and back 427ae115bc7Smrj */ 428ae115bc7Smrj #define kbtop(x) ((x) >> (PAGESHIFT - 10)) 429ae115bc7Smrj #define ptokb(x) ((x) << (PAGESHIFT - 10)) 430ae115bc7Smrj 4317c478bd9Sstevel@tonic-gate /* 4327c478bd9Sstevel@tonic-gate * POSIX.4 related configuration parameters 4337c478bd9Sstevel@tonic-gate */ 4347c478bd9Sstevel@tonic-gate #define _AIO_LISTIO_MAX (4096) 4357c478bd9Sstevel@tonic-gate #define _AIO_MAX (-1) 43606a502e8Scasper #define _MQ_OPEN_MAX (-1) 4377c478bd9Sstevel@tonic-gate #define _MQ_PRIO_MAX (32) 4387c478bd9Sstevel@tonic-gate #define _SEM_NSEMS_MAX INT_MAX 4397c478bd9Sstevel@tonic-gate #define _SEM_VALUE_MAX INT_MAX 4407c478bd9Sstevel@tonic-gate 4417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4427c478bd9Sstevel@tonic-gate } 4437c478bd9Sstevel@tonic-gate #endif 4447c478bd9Sstevel@tonic-gate 4457c478bd9Sstevel@tonic-gate #else /* (defined(_KERNEL) || defined(_KMEMUSER)) */ 4467c478bd9Sstevel@tonic-gate 4477c478bd9Sstevel@tonic-gate /* 4487c478bd9Sstevel@tonic-gate * The following are assorted machine dependent values which can be 4497c478bd9Sstevel@tonic-gate * obtained in a machine independent manner through sysconf(2) or 4507c478bd9Sstevel@tonic-gate * sysinfo(2). In order to guarantee that these provide the expected 4517c478bd9Sstevel@tonic-gate * value at all times, the System Private interface (leading underscore) 4527c478bd9Sstevel@tonic-gate * is used. 4537c478bd9Sstevel@tonic-gate */ 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate #include <sys/unistd.h> 4567c478bd9Sstevel@tonic-gate 4577c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4587c478bd9Sstevel@tonic-gate extern "C" { 4597c478bd9Sstevel@tonic-gate #endif 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate #if !defined(_ASM) 4627c478bd9Sstevel@tonic-gate extern long _sysconf(int); /* System Private interface to sysconf() */ 4637c478bd9Sstevel@tonic-gate #endif /* !defined(_ASM) */ 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate #define HZ ((clock_t)_sysconf(_SC_CLK_TCK)) 4667c478bd9Sstevel@tonic-gate #define TICK (1000000000/((clock_t)_sysconf(_SC_CLK_TCK))) 4677c478bd9Sstevel@tonic-gate #define PAGESIZE (_sysconf(_SC_PAGESIZE)) 4687c478bd9Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 4697c478bd9Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 4707c478bd9Sstevel@tonic-gate #define MAXPID ((pid_t)_sysconf(_SC_MAXPID)) 471*f48205beScasper #define MAXEPHUID ((uid_t)_sysconf(_SC_EPHID_MAX)) 4727c478bd9Sstevel@tonic-gate 4737c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4747c478bd9Sstevel@tonic-gate } 4757c478bd9Sstevel@tonic-gate #endif 4767c478bd9Sstevel@tonic-gate 4777c478bd9Sstevel@tonic-gate #endif /* (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP) */ 4787c478bd9Sstevel@tonic-gate 4797c478bd9Sstevel@tonic-gate #endif /* _SYS_PARAM_H */ 480