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