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 */ 2189621fe1SMarcel Telka 227c478bd9Sstevel@tonic-gate /* 2389621fe1SMarcel Telka * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 24cb15d5d9SPeter Rival * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 28b4203d75SMarcel Telka /* 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 #ifndef _ASM /* Avoid typedef headaches for assembly files */ 447c478bd9Sstevel@tonic-gate #include <sys/types.h> 457c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 467c478bd9Sstevel@tonic-gate #endif /* _ASM */ 477c478bd9Sstevel@tonic-gate 484870e0a7SRichard PALO #include <sys/null.h> 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 742463e920SRichard Lowe /* The actual size of the TTY input queue */ 752463e920SRichard Lowe #define _TTY_BUFSIZ 2048 762463e920SRichard Lowe 772463e920SRichard Lowe /* 782463e920SRichard Lowe * These defines all have their historical value. The actual size of the tty 792463e920SRichard Lowe * buffer both for the line-editor in ldterm, and in general, is above as 802463e920SRichard Lowe * _TTY_BUFSIZ. 812463e920SRichard Lowe * 822463e920SRichard Lowe * We leave these defines at their historical value to match the behaviour of 832463e920SRichard Lowe * BSD and Linux. 842463e920SRichard Lowe */ 857c478bd9Sstevel@tonic-gate #ifndef MAX_INPUT 867c478bd9Sstevel@tonic-gate #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ 877c478bd9Sstevel@tonic-gate #endif 887c478bd9Sstevel@tonic-gate #ifndef MAX_CANON 897c478bd9Sstevel@tonic-gate #define MAX_CANON 256 /* Maximum bytes for canonical processing */ 907c478bd9Sstevel@tonic-gate #endif 912463e920SRichard Lowe #define CANBSIZ 256 /* max size of typewriter line */ 922463e920SRichard Lowe 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #define UID_NOBODY 60001 /* user ID no body */ 957c478bd9Sstevel@tonic-gate #define GID_NOBODY UID_NOBODY 96e913d9ecSLisa Week #define UID_UNKNOWN 96 97e913d9ecSLisa Week #define GID_UNKNOWN UID_UNKNOWN 98b9e076dcSyz #define UID_DLADM 15 996ba597c5SAnurag S. Maskey #define UID_NETADM 16 1006ba597c5SAnurag S. Maskey #define GID_NETADM 65 1017c478bd9Sstevel@tonic-gate #define UID_NOACCESS 60002 /* user ID no access */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1047c478bd9Sstevel@tonic-gate #define MAX_TASKID 999999 1057c478bd9Sstevel@tonic-gate #define MAX_MAXPID 999999 106f48205beScasper #define MAXEPHUID 0xfffffffcu /* max ephemeral user id */ 10735a5a358SJonathan Adams 10835a5a358SJonathan Adams #define FAMOUS_PID_SCHED 0 10935a5a358SJonathan Adams #define FAMOUS_PID_INIT 1 11035a5a358SJonathan Adams #define FAMOUS_PID_PAGEOUT 2 11135a5a358SJonathan Adams #define FAMOUS_PID_FSFLUSH 3 11235a5a358SJonathan Adams #define FAMOUS_PIDS 4 1137c478bd9Sstevel@tonic-gate #endif 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #ifdef DEBUG 1167c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 999999 1177c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 100000 1187c478bd9Sstevel@tonic-gate #else 1197c478bd9Sstevel@tonic-gate #define DEFAULT_MAXPID 30000 1207c478bd9Sstevel@tonic-gate #define DEFAULT_JUMPPID 0 1217c478bd9Sstevel@tonic-gate #endif 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate #define MAXUID 2147483647 /* max user id */ 124f48205beScasper 1257c478bd9Sstevel@tonic-gate #define MAXPROJID MAXUID /* max project id */ 1267c478bd9Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 1277c478bd9Sstevel@tonic-gate 128f48205beScasper #define MINEPHUID 0x80000000u /* min ephemeral user id */ 129f48205beScasper 1307c478bd9Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate #define NOFILE 20 /* this define is here for */ 1337c478bd9Sstevel@tonic-gate /* compatibility purposes only */ 1347c478bd9Sstevel@tonic-gate /* and will be removed in a */ 1357c478bd9Sstevel@tonic-gate /* later release */ 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * These define the maximum and minimum allowable values of the 1397c478bd9Sstevel@tonic-gate * configurable parameter NGROUPS_MAX. 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate #define NGROUPS_UMIN 0 14267dbe2beSCasper H.S. Dik #define NGROUPS_UMAX 1024 14367dbe2beSCasper H.S. Dik #define NGROUPS_OLDMAX 32 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * NGROUPS_MAX_DEFAULT: *MUST* match NGROUPS_MAX value in limits.h. 1477c478bd9Sstevel@tonic-gate */ 1487c478bd9Sstevel@tonic-gate #define NGROUPS_MAX_DEFAULT 16 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate /* 1517c478bd9Sstevel@tonic-gate * Default process priority. Keep it in sync with limits.h. 1527c478bd9Sstevel@tonic-gate */ 1537c478bd9Sstevel@tonic-gate #define NZERO 20 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily. 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate 159*3c4c5929SGordon Ross #if !defined(_ASM) 1607c478bd9Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 161*3c4c5929SGordon Ross #endif /* _ASM */ 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #define CMASK 022 /* default mask for file creation */ 1647c478bd9Sstevel@tonic-gate #define CDLIMIT (1L<<11) /* default max write address */ 1657c478bd9Sstevel@tonic-gate #define NBPS 0x20000 /* Number of bytes per segment */ 1667c478bd9Sstevel@tonic-gate #define NBPSCTR 512 /* Bytes per disk sector. */ 1677c478bd9Sstevel@tonic-gate #define UBSIZE 512 /* unix block size. */ 1687c478bd9Sstevel@tonic-gate #define SCTRSHFT 9 /* Shift for BPSECT. */ 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #ifdef _LITTLE_ENDIAN 1717c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[0]) 1727c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[1]) 1737c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[0]) 1747c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[1]) 1757c478bd9Sstevel@tonic-gate #endif 1767c478bd9Sstevel@tonic-gate #ifdef _BIG_ENDIAN 1777c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[1]) 1787c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[0]) 1797c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[1]) 1807c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[0]) 1817c478bd9Sstevel@tonic-gate #endif 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate /* REMOTE -- whether machine is primary, secondary, or regular */ 1847c478bd9Sstevel@tonic-gate #define SYSNAME 9 /* # chars in system name */ 1857c478bd9Sstevel@tonic-gate #define PREMOTE 39 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length, 1897c478bd9Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 1907c478bd9Sstevel@tonic-gate * TYPICALMAXPATHLEN is used in a few places as an optimization 1917c478bd9Sstevel@tonic-gate * with a local buffer on the stack to avoid kmem_alloc(). 1927c478bd9Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 1937c478bd9Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 1947c478bd9Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 1957c478bd9Sstevel@tonic-gate * reasonably quickly. 1967c478bd9Sstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of 1977c478bd9Sstevel@tonic-gate * the longest permissible file (component) name. 1987c478bd9Sstevel@tonic-gate */ 1997c478bd9Sstevel@tonic-gate #define MAXPATHLEN 1024 2007c478bd9Sstevel@tonic-gate #define TYPICALMAXPATHLEN 64 2017c478bd9Sstevel@tonic-gate #define MAXSYMLINKS 20 2027c478bd9Sstevel@tonic-gate #define MAXNAMELEN 256 2037c478bd9Sstevel@tonic-gate 204d62bc4baSyz /* 205d62bc4baSyz * MAXLINKNAMELEN defines the longest possible permitted datalink name, 206d62bc4baSyz * including the terminating NUL. Note that this must not be larger 207d62bc4baSyz * than related networking constants such as LIFNAMSIZ. 208d62bc4baSyz */ 209d62bc4baSyz #define MAXLINKNAMELEN 32 210d62bc4baSyz 2117c478bd9Sstevel@tonic-gate #ifndef NADDR 2127c478bd9Sstevel@tonic-gate #define NADDR 13 2137c478bd9Sstevel@tonic-gate #endif 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate /* 2167c478bd9Sstevel@tonic-gate * The following are defined to be the same as 2177c478bd9Sstevel@tonic-gate * defined in /usr/include/limits.h. They are 2187c478bd9Sstevel@tonic-gate * needed for pipe and FIFO compatibility. 2197c478bd9Sstevel@tonic-gate */ 2207c478bd9Sstevel@tonic-gate #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ 2217c478bd9Sstevel@tonic-gate #define PIPE_BUF 5120 2227c478bd9Sstevel@tonic-gate #endif /* PIPE_BUF */ 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ 2257c478bd9Sstevel@tonic-gate #define PIPE_MAX 5120 2267c478bd9Sstevel@tonic-gate #endif /* PIPE_MAX */ 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate #ifndef NBBY 2297c478bd9Sstevel@tonic-gate #define NBBY 8 /* number of bits per byte */ 2307c478bd9Sstevel@tonic-gate #endif 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate /* macros replacing interleaving functions */ 2337c478bd9Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 2347c478bd9Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate /* 2377c478bd9Sstevel@tonic-gate * File system parameters and macros. 2387c478bd9Sstevel@tonic-gate * 2397c478bd9Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 2407c478bd9Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 2417c478bd9Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 2427c478bd9Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 2437c478bd9Sstevel@tonic-gate * file systems; however making it smaller make make some file 2447c478bd9Sstevel@tonic-gate * systems unmountable. 2457c478bd9Sstevel@tonic-gate * 2467c478bd9Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 2477c478bd9Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 2487c478bd9Sstevel@tonic-gate */ 2497c478bd9Sstevel@tonic-gate #define MAXBSIZE 8192 2507c478bd9Sstevel@tonic-gate #define DEV_BSIZE 512 2517c478bd9Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 2527c478bd9Sstevel@tonic-gate #define MAXFRAG 8 2537c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2547c478bd9Sstevel@tonic-gate #define MAXOFF32_T 0x7fffffff 2557c478bd9Sstevel@tonic-gate #endif 2567c478bd9Sstevel@tonic-gate #ifdef _LP64 2577c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffffffffffl 2587c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffl 2597c478bd9Sstevel@tonic-gate #else 2607c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffl 2617c478bd9Sstevel@tonic-gate #ifdef _LONGLONG_TYPE 2627c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffLL 2637c478bd9Sstevel@tonic-gate #else 2647c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffff 2657c478bd9Sstevel@tonic-gate #endif 2667c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2697c478bd9Sstevel@tonic-gate ((unsigned long)(bytes) >> DEV_BSHIFT) 2707c478bd9Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2717c478bd9Sstevel@tonic-gate ((unsigned long)(db) << DEV_BSHIFT) 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate /* 64 bit versions of btodb and dbtob */ 2747c478bd9Sstevel@tonic-gate #define lbtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 2757c478bd9Sstevel@tonic-gate ((u_offset_t)(bytes) >> DEV_BSHIFT) 2767c478bd9Sstevel@tonic-gate #define ldbtob(db) /* calculates (db * DEV_BSIZE) */ \ 2777c478bd9Sstevel@tonic-gate ((u_offset_t)(db) << DEV_BSHIFT) 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate #ifndef _ASM /* Avoid typedef headaches for assembly files */ 2807c478bd9Sstevel@tonic-gate #ifndef NODEV 2817c478bd9Sstevel@tonic-gate #define NODEV (dev_t)(-1l) 2827c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 2837c478bd9Sstevel@tonic-gate #define NODEV32 (dev32_t)(-1) 2847c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2857c478bd9Sstevel@tonic-gate #endif /* NODEV */ 2867c478bd9Sstevel@tonic-gate #endif /* _ASM */ 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate /* 2897c478bd9Sstevel@tonic-gate * Size of arg list passed in by user. 2907c478bd9Sstevel@tonic-gate */ 2917c478bd9Sstevel@tonic-gate #define NCARGS32 0x100000 2927c478bd9Sstevel@tonic-gate #define NCARGS64 0x200000 2937c478bd9Sstevel@tonic-gate #ifdef _LP64 2947c478bd9Sstevel@tonic-gate #define NCARGS NCARGS64 2957c478bd9Sstevel@tonic-gate #else /* _LP64 */ 2967c478bd9Sstevel@tonic-gate #define NCARGS NCARGS32 2977c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate /* 3007c478bd9Sstevel@tonic-gate * Scale factor for scaled integers used to count 3017c478bd9Sstevel@tonic-gate * %cpu time and load averages. 3027c478bd9Sstevel@tonic-gate */ 3037c478bd9Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 3047c478bd9Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate /* 3077c478bd9Sstevel@tonic-gate * Delay units are in microseconds. 3087c478bd9Sstevel@tonic-gate * 3097c478bd9Sstevel@tonic-gate * XXX These macros are not part of the DDI! 3107c478bd9Sstevel@tonic-gate */ 3117c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3127c478bd9Sstevel@tonic-gate extern void drv_usecwait(clock_t); 3137c478bd9Sstevel@tonic-gate #define DELAY(n) drv_usecwait(n) 3147c478bd9Sstevel@tonic-gate #define CDELAY(c, n) \ 3157c478bd9Sstevel@tonic-gate { \ 3167c478bd9Sstevel@tonic-gate register int N = n; \ 3177c478bd9Sstevel@tonic-gate while (--N > 0) { \ 3187c478bd9Sstevel@tonic-gate if (c) \ 3197c478bd9Sstevel@tonic-gate break; \ 3207c478bd9Sstevel@tonic-gate drv_usecwait(1); \ 3217c478bd9Sstevel@tonic-gate } \ 3227c478bd9Sstevel@tonic-gate } 3237c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3267c478bd9Sstevel@tonic-gate } 3277c478bd9Sstevel@tonic-gate #endif 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate /* 3307c478bd9Sstevel@tonic-gate * The following is to free utilities from machine dependencies within 3317c478bd9Sstevel@tonic-gate * an architecture. Must be included after definition of DEV_BSIZE. 3327c478bd9Sstevel@tonic-gate */ 3337c478bd9Sstevel@tonic-gate 334*3c4c5929SGordon Ross #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_BOOT) 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate #if defined(_MACHDEP) 3377c478bd9Sstevel@tonic-gate #include <sys/machparam.h> 3387c478bd9Sstevel@tonic-gate #endif 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3417c478bd9Sstevel@tonic-gate extern "C" { 3427c478bd9Sstevel@tonic-gate #endif 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3457c478bd9Sstevel@tonic-gate extern int cpu_decay_factor; 3467c478bd9Sstevel@tonic-gate extern pid_t maxpid; 3477c478bd9Sstevel@tonic-gate extern pid_t jump_pid; 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate extern uintptr_t _kernelbase; 3507c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit; 3517c478bd9Sstevel@tonic-gate extern uintptr_t _userlimit32; 3527c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3537c478bd9Sstevel@tonic-gate 3548793b36bSNick Todd /* 3558793b36bSNick Todd * These three variables have been added within the #if defined(lint) 3568793b36bSNick Todd * below to ensure visibility to lint. This is a short term workaround 3578793b36bSNick Todd * to handle poor interaction between SS12 lint and these variables. 3588793b36bSNick Todd * CR 6742611 has been logged to address these issues. 3598793b36bSNick Todd */ 3608793b36bSNick Todd #if defined(lint) 3618793b36bSNick Todd extern int snooping; 3628793b36bSNick Todd extern uint_t snoop_interval; 3638793b36bSNick Todd extern const unsigned int _pageshift; 3648793b36bSNick Todd #endif /* lint */ 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate #if !defined(_MACHDEP) 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate /* 3697c478bd9Sstevel@tonic-gate * Implementation architecture independent sections of the kernel use 3707c478bd9Sstevel@tonic-gate * this section. 3717c478bd9Sstevel@tonic-gate */ 3727c478bd9Sstevel@tonic-gate #if defined(_KERNEL) && !defined(_ASM) 3737c478bd9Sstevel@tonic-gate extern int hz; 3747c478bd9Sstevel@tonic-gate extern int snooping; 3757c478bd9Sstevel@tonic-gate extern uint_t snoop_interval; 3767c478bd9Sstevel@tonic-gate extern const unsigned long _pagesize; 3777c478bd9Sstevel@tonic-gate extern const unsigned int _pageshift; 3787c478bd9Sstevel@tonic-gate extern const unsigned long _pageoffset; 3797c478bd9Sstevel@tonic-gate extern const unsigned long long _pagemask; 3807c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagesize; 3817c478bd9Sstevel@tonic-gate extern const unsigned int _mmu_pageshift; 3827c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pageoffset; 3837c478bd9Sstevel@tonic-gate extern const unsigned long _mmu_pagemask; 3847c478bd9Sstevel@tonic-gate extern const uintptr_t _argsbase; 3857c478bd9Sstevel@tonic-gate extern const unsigned long _defaultstksz; 3867c478bd9Sstevel@tonic-gate extern const unsigned int _nbpg; 3877c478bd9Sstevel@tonic-gate extern const int _ncpu; 38823d9e5acSMichael Corcoran extern const int _ncpu_log2; 389cb15d5d9SPeter Rival extern const int _ncpu_p2; 3907c478bd9Sstevel@tonic-gate extern const int _clsize; 3917c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) && !defined(_ASM) */ 3927c478bd9Sstevel@tonic-gate 39342a4b3dcSJonathan Adams /* Any additions to these #defines must be reflected in mdb_param.h+mdb_ks.c */ 3947c478bd9Sstevel@tonic-gate #define PAGESIZE _pagesize 3957c478bd9Sstevel@tonic-gate #define PAGESHIFT _pageshift 3967c478bd9Sstevel@tonic-gate #define PAGEOFFSET _pageoffset 3977c478bd9Sstevel@tonic-gate #define PAGEMASK _pagemask 3987c478bd9Sstevel@tonic-gate #define MMU_PAGESIZE _mmu_pagesize 3997c478bd9Sstevel@tonic-gate #define MMU_PAGESHIFT _mmu_pageshift 4007c478bd9Sstevel@tonic-gate #define MMU_PAGEOFFSET _mmu_pageoffset 4017c478bd9Sstevel@tonic-gate #define MMU_PAGEMASK _mmu_pagemask 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate #define KERNELBASE _kernelbase 4047c478bd9Sstevel@tonic-gate #define USERLIMIT _userlimit 4057c478bd9Sstevel@tonic-gate #define USERLIMIT32 _userlimit32 4067c478bd9Sstevel@tonic-gate #define ARGSBASE _argsbase 4077c478bd9Sstevel@tonic-gate #define DEFAULTSTKSZ _defaultstksz 4087c478bd9Sstevel@tonic-gate #define NCPU _ncpu 40923d9e5acSMichael Corcoran #define NCPU_LOG2 _ncpu_log2 410cb15d5d9SPeter Rival #define NCPU_P2 _ncpu_p2 4117c478bd9Sstevel@tonic-gate 4127c478bd9Sstevel@tonic-gate #endif /* defined(_MACHDEP) */ 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate /* 4157c478bd9Sstevel@tonic-gate * Some random macros for units conversion. 4167c478bd9Sstevel@tonic-gate * 4177c478bd9Sstevel@tonic-gate * These are machine independent but contain constants (*PAGESHIFT) which 4187c478bd9Sstevel@tonic-gate * are only defined in the machine dependent file. 4197c478bd9Sstevel@tonic-gate */ 4207c478bd9Sstevel@tonic-gate 4217c478bd9Sstevel@tonic-gate /* 4227c478bd9Sstevel@tonic-gate * MMU pages to bytes, and back (with and without rounding) 4237c478bd9Sstevel@tonic-gate */ 4247c478bd9Sstevel@tonic-gate #define mmu_ptob(x) ((x) << MMU_PAGESHIFT) 4257c478bd9Sstevel@tonic-gate #define mmu_btop(x) (((x)) >> MMU_PAGESHIFT) 4267c478bd9Sstevel@tonic-gate #define mmu_btopr(x) ((((x) + MMU_PAGEOFFSET) >> MMU_PAGESHIFT)) 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate /* 4297c478bd9Sstevel@tonic-gate * 2 versions of pages to disk blocks 4307c478bd9Sstevel@tonic-gate */ 4317c478bd9Sstevel@tonic-gate #define mmu_ptod(x) ((x) << (MMU_PAGESHIFT - DEV_BSHIFT)) 4327c478bd9Sstevel@tonic-gate #define ptod(x) ((x) << (PAGESHIFT - DEV_BSHIFT)) 4337c478bd9Sstevel@tonic-gate 4347c478bd9Sstevel@tonic-gate /* 4357c478bd9Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 4367c478bd9Sstevel@tonic-gate * Large Files: The explicit cast of x to unsigned int is deliberately 4377c478bd9Sstevel@tonic-gate * removed as part of large files work. We pass longlong values to 4387c478bd9Sstevel@tonic-gate * theses macros. 4397c478bd9Sstevel@tonic-gate * 4407c478bd9Sstevel@tonic-gate * Cast the input to ptob() to be a page count. This enforces 64-bit 4417c478bd9Sstevel@tonic-gate * math on 64-bit kernels. For 32-bit kernels, callers must explicitly 4427c478bd9Sstevel@tonic-gate * cast the input to be a 64-bit type if values greater than 4GB/PAGESIZE 4437c478bd9Sstevel@tonic-gate * are possible. 4447c478bd9Sstevel@tonic-gate */ 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate #ifdef _LP64 4477c478bd9Sstevel@tonic-gate #define ptob(x) (((pgcnt_t)(x)) << PAGESHIFT) 4487c478bd9Sstevel@tonic-gate #else 4497c478bd9Sstevel@tonic-gate #define ptob(x) ((x) << PAGESHIFT) 4507c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4517c478bd9Sstevel@tonic-gate #define btop(x) (((x) >> PAGESHIFT)) 4527c478bd9Sstevel@tonic-gate #define btopr(x) ((((x) + PAGEOFFSET) >> PAGESHIFT)) 4537c478bd9Sstevel@tonic-gate 4547c478bd9Sstevel@tonic-gate /* 4557c478bd9Sstevel@tonic-gate * disk blocks to pages, rounded and truncated 4567c478bd9Sstevel@tonic-gate */ 4577c478bd9Sstevel@tonic-gate #define NDPP (PAGESIZE/DEV_BSIZE) /* # of disk blocks per page */ 4587c478bd9Sstevel@tonic-gate #define dtop(DD) (((DD) + NDPP - 1) >> (PAGESHIFT - DEV_BSHIFT)) 4597c478bd9Sstevel@tonic-gate #define dtopt(DD) ((DD) >> (PAGESHIFT - DEV_BSHIFT)) 4607c478bd9Sstevel@tonic-gate 461ae115bc7Smrj /* 462ae115bc7Smrj * kB to pages and back 463ae115bc7Smrj */ 464ae115bc7Smrj #define kbtop(x) ((x) >> (PAGESHIFT - 10)) 465ae115bc7Smrj #define ptokb(x) ((x) << (PAGESHIFT - 10)) 466ae115bc7Smrj 4677c478bd9Sstevel@tonic-gate /* 4687c478bd9Sstevel@tonic-gate * POSIX.4 related configuration parameters 4697c478bd9Sstevel@tonic-gate */ 4707c478bd9Sstevel@tonic-gate #define _AIO_LISTIO_MAX (4096) 4717c478bd9Sstevel@tonic-gate #define _AIO_MAX (-1) 47206a502e8Scasper #define _MQ_OPEN_MAX (-1) 4737c478bd9Sstevel@tonic-gate #define _MQ_PRIO_MAX (32) 4747c478bd9Sstevel@tonic-gate #define _SEM_NSEMS_MAX INT_MAX 4757c478bd9Sstevel@tonic-gate #define _SEM_VALUE_MAX INT_MAX 4767c478bd9Sstevel@tonic-gate 4777c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4787c478bd9Sstevel@tonic-gate } 4797c478bd9Sstevel@tonic-gate #endif 4807c478bd9Sstevel@tonic-gate 481*3c4c5929SGordon Ross #else /* defined(_KERNEL) || defined(_KMEMUSER) || defined(_BOOT) */ 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate /* 4847c478bd9Sstevel@tonic-gate * The following are assorted machine dependent values which can be 4857c478bd9Sstevel@tonic-gate * obtained in a machine independent manner through sysconf(2) or 4867c478bd9Sstevel@tonic-gate * sysinfo(2). In order to guarantee that these provide the expected 4877c478bd9Sstevel@tonic-gate * value at all times, the System Private interface (leading underscore) 4887c478bd9Sstevel@tonic-gate * is used. 4897c478bd9Sstevel@tonic-gate */ 4907c478bd9Sstevel@tonic-gate 4917c478bd9Sstevel@tonic-gate #include <sys/unistd.h> 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4947c478bd9Sstevel@tonic-gate extern "C" { 4957c478bd9Sstevel@tonic-gate #endif 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate #if !defined(_ASM) 4987c478bd9Sstevel@tonic-gate extern long _sysconf(int); /* System Private interface to sysconf() */ 4997c478bd9Sstevel@tonic-gate #endif /* !defined(_ASM) */ 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate #define HZ ((clock_t)_sysconf(_SC_CLK_TCK)) 5027c478bd9Sstevel@tonic-gate #define TICK (1000000000/((clock_t)_sysconf(_SC_CLK_TCK))) 5037c478bd9Sstevel@tonic-gate #define PAGESIZE (_sysconf(_SC_PAGESIZE)) 5047c478bd9Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 5057c478bd9Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 5067c478bd9Sstevel@tonic-gate #define MAXPID ((pid_t)_sysconf(_SC_MAXPID)) 507f48205beScasper #define MAXEPHUID ((uid_t)_sysconf(_SC_EPHID_MAX)) 5087c478bd9Sstevel@tonic-gate 5097c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5107c478bd9Sstevel@tonic-gate } 5117c478bd9Sstevel@tonic-gate #endif 5127c478bd9Sstevel@tonic-gate 513*3c4c5929SGordon Ross #endif /* defined(_KERNEL) || defined(_KMEMUSER) || defined(_BOOT) */ 5147c478bd9Sstevel@tonic-gate 5157c478bd9Sstevel@tonic-gate #endif /* _SYS_PARAM_H */ 516