1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* 31*7c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 32*7c478bd9Sstevel@tonic-gate * The Regents of the University of California 33*7c478bd9Sstevel@tonic-gate * All Rights Reserved 34*7c478bd9Sstevel@tonic-gate * 35*7c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 36*7c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 37*7c478bd9Sstevel@tonic-gate * contributors. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifndef _SYS_PARAM_H 41*7c478bd9Sstevel@tonic-gate #define _SYS_PARAM_H 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Fundamental variables; don't change too often. 48*7c478bd9Sstevel@tonic-gate * 49*7c478bd9Sstevel@tonic-gate * This file is included here for compatibility with 50*7c478bd9Sstevel@tonic-gate * SunOS, but it does *not* include all the values 51*7c478bd9Sstevel@tonic-gate * define in the SunOS version of this file. 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 55*7c478bd9Sstevel@tonic-gate #include <limits.h> 56*7c478bd9Sstevel@tonic-gate #include <unistd.h> 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 59*7c478bd9Sstevel@tonic-gate extern "C" { 60*7c478bd9Sstevel@tonic-gate #endif 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate #ifndef MAX_INPUT 63*7c478bd9Sstevel@tonic-gate #define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ 64*7c478bd9Sstevel@tonic-gate #endif 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate #ifndef MAX_CANON 67*7c478bd9Sstevel@tonic-gate #define MAX_CANON 256 /* Maximum bytes for canoical processing */ 68*7c478bd9Sstevel@tonic-gate #endif 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate #define UID_NOBODY 60001 71*7c478bd9Sstevel@tonic-gate #define GID_NOBODY 60001 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #define UID_NOACCESS 60002 /* user ID no access */ 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate #define MAXPID ((pid_t)sysconf(_SC_MAXPID)) /* max process id */ 76*7c478bd9Sstevel@tonic-gate #define MAXUID 2147483647 /* max user id */ 77*7c478bd9Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate /* The values below are defined in limits.h */ 82*7c478bd9Sstevel@tonic-gate #define NOFILE OPEN_MAX /* max open files per process */ 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate #define CANBSIZ 256 /* max size of typewriter line */ 85*7c478bd9Sstevel@tonic-gate #define HZ ((int)sysconf(_SC_CLK_TCK)) /* ticks/second of the clock */ 86*7c478bd9Sstevel@tonic-gate #define TICK (1000000000/((int)sysconf(_SC_CLK_TCK))) 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate #define NCARGS 0x100000 /* # characters in exec arglist */ 89*7c478bd9Sstevel@tonic-gate /* must be multiple of NBPW. */ 90*7c478bd9Sstevel@tonic-gate /* 91*7c478bd9Sstevel@tonic-gate * These define the maximum and minimum allowable values of the 92*7c478bd9Sstevel@tonic-gate * configurable parameter NGROUPS_MAX. 93*7c478bd9Sstevel@tonic-gate */ 94*7c478bd9Sstevel@tonic-gate #define NGROUPS_UMAX 32 95*7c478bd9Sstevel@tonic-gate #define NGROUPS_UMIN 8 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate #define NGROUPS NGROUPS_MAX /* max number groups, from limits.h */ 98*7c478bd9Sstevel@tonic-gate #define NOGROUP -1 /* marker for empty group set member */ 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate /* 101*7c478bd9Sstevel@tonic-gate * Priorities. Should not be altered too much. 102*7c478bd9Sstevel@tonic-gate */ 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate #define PMASK 0177 105*7c478bd9Sstevel@tonic-gate #define PCATCH 0400 106*7c478bd9Sstevel@tonic-gate #define PNOSTOP 01000 107*7c478bd9Sstevel@tonic-gate #define PSWP 0 108*7c478bd9Sstevel@tonic-gate #define PINOD 10 109*7c478bd9Sstevel@tonic-gate #define PSNDD PINOD 110*7c478bd9Sstevel@tonic-gate #define PAMAP PINOD 111*7c478bd9Sstevel@tonic-gate #define PPMAP PINOD 112*7c478bd9Sstevel@tonic-gate #define PRIBIO 20 113*7c478bd9Sstevel@tonic-gate #define PZERO 25 114*7c478bd9Sstevel@tonic-gate #define PMEM 0 115*7c478bd9Sstevel@tonic-gate #define NZERO 20 116*7c478bd9Sstevel@tonic-gate #define PPIPE 26 117*7c478bd9Sstevel@tonic-gate #define PVFS 27 118*7c478bd9Sstevel@tonic-gate #define PWAIT 30 119*7c478bd9Sstevel@tonic-gate #define PLOCK 35 120*7c478bd9Sstevel@tonic-gate #define PSLEP 39 121*7c478bd9Sstevel@tonic-gate #define PUSER 60 122*7c478bd9Sstevel@tonic-gate #define PIDLE 127 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate /* 125*7c478bd9Sstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily. 126*7c478bd9Sstevel@tonic-gate */ 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate #define NBPS 0x20000 /* Number of bytes per segment */ 129*7c478bd9Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && !defined(__cplusplus) 132*7c478bd9Sstevel@tonic-gate #define NULL 0L 133*7c478bd9Sstevel@tonic-gate #else 134*7c478bd9Sstevel@tonic-gate #define NULL 0 135*7c478bd9Sstevel@tonic-gate #endif 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate #define CMASK 0 /* default mask for file creation */ 138*7c478bd9Sstevel@tonic-gate #define CDLIMIT (1L<<11) /* default max write address */ 139*7c478bd9Sstevel@tonic-gate #define NODEV (dev_t)(-1) 140*7c478bd9Sstevel@tonic-gate #define NBPSCTR 512 /* Bytes per disk sector. */ 141*7c478bd9Sstevel@tonic-gate #define UBSIZE 512 /* unix block size. */ 142*7c478bd9Sstevel@tonic-gate #define SCTRSHFT 9 /* Shift for BPSECT. */ 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate #define lobyte(X) (((unsigned char *)&(X))[1]) 145*7c478bd9Sstevel@tonic-gate #define hibyte(X) (((unsigned char *)&(X))[0]) 146*7c478bd9Sstevel@tonic-gate #define loword(X) (((ushort_t *)&(X))[1]) 147*7c478bd9Sstevel@tonic-gate #define hiword(X) (((ushort_t *)&(X))[0]) 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate /* REMOTE -- whether machine is primary, secondary, or regular */ 150*7c478bd9Sstevel@tonic-gate #define SYSNAME 9 /* # chars in system name */ 151*7c478bd9Sstevel@tonic-gate #define PREMOTE 39 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate /* 154*7c478bd9Sstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length, 155*7c478bd9Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 156*7c478bd9Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 157*7c478bd9Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 158*7c478bd9Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 159*7c478bd9Sstevel@tonic-gate * reasonably quickly. 160*7c478bd9Sstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of 161*7c478bd9Sstevel@tonic-gate * the longest permissible file (component) name. 162*7c478bd9Sstevel@tonic-gate */ 163*7c478bd9Sstevel@tonic-gate #define MAXPATHLEN 1024 164*7c478bd9Sstevel@tonic-gate #define MAXSYMLINKS 20 165*7c478bd9Sstevel@tonic-gate #define MAXNAMELEN 256 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate #ifndef NADDR 168*7c478bd9Sstevel@tonic-gate #define NADDR 13 169*7c478bd9Sstevel@tonic-gate #endif 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate /* 172*7c478bd9Sstevel@tonic-gate * The following are defined to be the same as 173*7c478bd9Sstevel@tonic-gate * defined in /usr/include/limits.h. They are 174*7c478bd9Sstevel@tonic-gate * needed for pipe and FIFO compatibility. 175*7c478bd9Sstevel@tonic-gate */ 176*7c478bd9Sstevel@tonic-gate #ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ 177*7c478bd9Sstevel@tonic-gate #define PIPE_BUF 5120 178*7c478bd9Sstevel@tonic-gate #endif /* PIPE_BUF */ 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ 181*7c478bd9Sstevel@tonic-gate #define PIPE_MAX 5120 182*7c478bd9Sstevel@tonic-gate #endif /* PIPE_MAX */ 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate #define PIPEBUF PIPE_BUF /* pipe buffer size */ 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate #ifndef NBBY 187*7c478bd9Sstevel@tonic-gate #define NBBY 8 /* number of bits per byte */ 188*7c478bd9Sstevel@tonic-gate #endif 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate /* macros replacing interleaving functions */ 191*7c478bd9Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 192*7c478bd9Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate /* 195*7c478bd9Sstevel@tonic-gate * File system parameters and macros. 196*7c478bd9Sstevel@tonic-gate * 197*7c478bd9Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 198*7c478bd9Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 199*7c478bd9Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 200*7c478bd9Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 201*7c478bd9Sstevel@tonic-gate * file systems; however making it smaller make make some file 202*7c478bd9Sstevel@tonic-gate * systems unmountable. 203*7c478bd9Sstevel@tonic-gate * 204*7c478bd9Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 205*7c478bd9Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate #define MAXBSIZE 8192 208*7c478bd9Sstevel@tonic-gate #define DEV_BSIZE 512 209*7c478bd9Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 210*7c478bd9Sstevel@tonic-gate #define MAXFRAG 8 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate #ifdef _LP64 213*7c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffffffffffffl 214*7c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffll 215*7c478bd9Sstevel@tonic-gate #else 216*7c478bd9Sstevel@tonic-gate #define MAXOFF_T 0x7fffffff 217*7c478bd9Sstevel@tonic-gate #ifndef _LONGLONG_TYPE 218*7c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffff 219*7c478bd9Sstevel@tonic-gate #else 220*7c478bd9Sstevel@tonic-gate #define MAXOFFSET_T 0x7fffffffffffffffLL 221*7c478bd9Sstevel@tonic-gate #endif 222*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 225*7c478bd9Sstevel@tonic-gate ((unsigned)(bytes) >> DEV_BSHIFT) 226*7c478bd9Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 227*7c478bd9Sstevel@tonic-gate ((unsigned)(db) << DEV_BSHIFT) 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate /* 230*7c478bd9Sstevel@tonic-gate * PAGES* describes the logical page size used by the system. 231*7c478bd9Sstevel@tonic-gate */ 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate #define PAGESIZE (sysconf(_SC_PAGESIZE)) /* All the above, for logical */ 234*7c478bd9Sstevel@tonic-gate #define PAGEOFFSET (PAGESIZE - 1) 235*7c478bd9Sstevel@tonic-gate #define PAGEMASK (~PAGEOFFSET) 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate /* 238*7c478bd9Sstevel@tonic-gate * Some random macros for units conversion. 239*7c478bd9Sstevel@tonic-gate */ 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate /* 242*7c478bd9Sstevel@tonic-gate * pages to bytes, and back (with and without rounding) 243*7c478bd9Sstevel@tonic-gate */ 244*7c478bd9Sstevel@tonic-gate #define ptob(x) ((x) * PAGESIZE) 245*7c478bd9Sstevel@tonic-gate #define btop(x) (((unsigned)(x)) / PAGESIZE) 246*7c478bd9Sstevel@tonic-gate #define btopr(x) ((((unsigned)(x) + PAGEOFFSET) / PAGESIZE)) 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate /* 249*7c478bd9Sstevel@tonic-gate * Signals 250*7c478bd9Sstevel@tonic-gate */ 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate #include <sys/signal.h> 253*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate /* 256*7c478bd9Sstevel@tonic-gate * bit map related macros 257*7c478bd9Sstevel@tonic-gate */ 258*7c478bd9Sstevel@tonic-gate #define setbit(a, i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 259*7c478bd9Sstevel@tonic-gate #define clrbit(a, i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 260*7c478bd9Sstevel@tonic-gate #define isset(a, i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 261*7c478bd9Sstevel@tonic-gate #define isclr(a, i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate /* 264*7c478bd9Sstevel@tonic-gate * Macros for fast min/max. 265*7c478bd9Sstevel@tonic-gate */ 266*7c478bd9Sstevel@tonic-gate #ifndef MIN 267*7c478bd9Sstevel@tonic-gate #define MIN(a, b) (((a) < (b))?(a):(b)) 268*7c478bd9Sstevel@tonic-gate #endif 269*7c478bd9Sstevel@tonic-gate #ifndef MAX 270*7c478bd9Sstevel@tonic-gate #define MAX(a, b) (((a) > (b))?(a):(b)) 271*7c478bd9Sstevel@tonic-gate #endif 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate #define howmany(x, y) (((x)+((y)-1))/(y)) 274*7c478bd9Sstevel@tonic-gate #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate /* 277*7c478bd9Sstevel@tonic-gate * Scale factor for scaled integers used to count 278*7c478bd9Sstevel@tonic-gate * %cpu time and load averages. 279*7c478bd9Sstevel@tonic-gate */ 280*7c478bd9Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 281*7c478bd9Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 282*7c478bd9Sstevel@tonic-gate 283*7c478bd9Sstevel@tonic-gate /* 284*7c478bd9Sstevel@tonic-gate * Maximum size of hostname recognized and stored in the kernel. 285*7c478bd9Sstevel@tonic-gate * Same as in /usr/include/netdb.h 286*7c478bd9Sstevel@tonic-gate */ 287*7c478bd9Sstevel@tonic-gate #ifndef MAXHOSTNAMELEN 288*7c478bd9Sstevel@tonic-gate #define MAXHOSTNAMELEN 256 289*7c478bd9Sstevel@tonic-gate #endif 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 292*7c478bd9Sstevel@tonic-gate } 293*7c478bd9Sstevel@tonic-gate #endif 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate #endif /* _SYS_PARAM_H */ 296