1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 1989 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #ifndef __sys_param_h 30*0Sstevel@tonic-gate #define __sys_param_h 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * Machine type dependent parameters. 34*0Sstevel@tonic-gate */ 35*0Sstevel@tonic-gate #include <machine/param.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #define NPTEPG (NBPG/(sizeof (struct pte))) 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate /* 40*0Sstevel@tonic-gate * Machine-independent constants 41*0Sstevel@tonic-gate */ 42*0Sstevel@tonic-gate #define NMOUNT 40 /* est. of # mountable fs for quota calc */ 43*0Sstevel@tonic-gate #define MSWAPX 15 /* pseudo mount table index for swapdev */ 44*0Sstevel@tonic-gate #define MAXUPRC 25 /* max processes per user */ 45*0Sstevel@tonic-gate #define NOFILE 256 /* max open files per process */ 46*0Sstevel@tonic-gate #define MAXPID 30000 /* max process id */ 47*0Sstevel@tonic-gate #define MAXUID 0xfffd /* max user id (from 60000) */ 48*0Sstevel@tonic-gate #define MAXLINK 32767 /* max links */ 49*0Sstevel@tonic-gate #define CANBSIZ 256 /* max size of typewriter line */ 50*0Sstevel@tonic-gate #define VDISABLE 0 /* use this to turn off c_cc[i] */ 51*0Sstevel@tonic-gate #define PIPE_BUF 4096 /* pipe buffer size */ 52*0Sstevel@tonic-gate #ifndef KERNEL 53*0Sstevel@tonic-gate /* 54*0Sstevel@tonic-gate * HZ defines the ticks/second for system calls, eg, times(), which 55*0Sstevel@tonic-gate * return values just in ticks; but not for getrusage(), which returns 56*0Sstevel@tonic-gate * values in ticks*pages. HZ *must* be 60 for compatibility reasons. 57*0Sstevel@tonic-gate */ 58*0Sstevel@tonic-gate #define HZ 60 59*0Sstevel@tonic-gate #endif 60*0Sstevel@tonic-gate #define NCARGS 0x100000 /* (absolute) max # characters in exec arglist */ 61*0Sstevel@tonic-gate /* If NGROUPS changes, change <sys/limits.h> NGROUPS_MAX at the same time. */ 62*0Sstevel@tonic-gate #define NGROUPS 16 /* max number groups */ 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate #define NOGROUP -1 /* marker for empty group set member */ 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate #ifdef KERNEL 67*0Sstevel@tonic-gate /* 68*0Sstevel@tonic-gate * Priorities 69*0Sstevel@tonic-gate */ 70*0Sstevel@tonic-gate #define PMASK 0177 71*0Sstevel@tonic-gate #define PCATCH 0400 /* return if sleep interrupted, don't longjmp */ 72*0Sstevel@tonic-gate #define PSWP 0 73*0Sstevel@tonic-gate #define PINOD 10 74*0Sstevel@tonic-gate #define PAMAP 10 75*0Sstevel@tonic-gate #define PRIBIO 20 76*0Sstevel@tonic-gate #define PRIUBA 24 77*0Sstevel@tonic-gate #define PZERO 25 78*0Sstevel@tonic-gate #define PPIPE 26 79*0Sstevel@tonic-gate #define PVFS 27 80*0Sstevel@tonic-gate #define PWAIT 30 81*0Sstevel@tonic-gate #define PLOCK 35 82*0Sstevel@tonic-gate #define PSLEP 40 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate #ifdef VPIX 85*0Sstevel@tonic-gate #define PV86 41 86*0Sstevel@tonic-gate #endif 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate #define PFLCK 42 /* File/Record lock */ 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate #define PUSER 50 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define NZERO 20 93*0Sstevel@tonic-gate #endif /* KERNEL */ 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate /* 96*0Sstevel@tonic-gate * Signals 97*0Sstevel@tonic-gate */ 98*0Sstevel@tonic-gate #include <sys/signal.h> 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate #define ISSIG(p, flag) \ 101*0Sstevel@tonic-gate ((p)->p_sig && ((p)->p_flag&STRC || \ 102*0Sstevel@tonic-gate ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig(flag)) 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate #define NBPW sizeof (int) /* number of bytes in an integer */ 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate #ifndef NULL 107*0Sstevel@tonic-gate #define NULL 0 108*0Sstevel@tonic-gate #endif 109*0Sstevel@tonic-gate #define CMASK 0 /* default mask for file creation */ 110*0Sstevel@tonic-gate #define NODEV (dev_t)(-1) 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #ifndef INTRLVE 113*0Sstevel@tonic-gate /* macros replacing interleaving functions */ 114*0Sstevel@tonic-gate #define dkblock(bp) ((bp)->b_blkno) 115*0Sstevel@tonic-gate #define dkunit(bp) (minor((bp)->b_dev) >> 3) 116*0Sstevel@tonic-gate #endif 117*0Sstevel@tonic-gate 118*0Sstevel@tonic-gate #define CBSIZE 28 /* number of chars in a clist block */ 119*0Sstevel@tonic-gate #define CROUND 0x1F /* clist rounding; sizeof (int *) + CBSIZE-1 */ 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate #if !defined(LOCORE) || !defined(KERNEL) 122*0Sstevel@tonic-gate #include <sys/types.h> 123*0Sstevel@tonic-gate #endif 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate /* 126*0Sstevel@tonic-gate * File system parameters and macros. 127*0Sstevel@tonic-gate * 128*0Sstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units, 129*0Sstevel@tonic-gate * with smaller units (fragments) only in the last direct block. 130*0Sstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer 131*0Sstevel@tonic-gate * pool. It may be made larger without any effect on existing 132*0Sstevel@tonic-gate * file systems; however making it smaller make make some file 133*0Sstevel@tonic-gate * systems unmountable. 134*0Sstevel@tonic-gate * 135*0Sstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE 136*0Sstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size. 137*0Sstevel@tonic-gate */ 138*0Sstevel@tonic-gate #define MAXBSIZE 8192 139*0Sstevel@tonic-gate #define DEV_BSIZE 512 140*0Sstevel@tonic-gate #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 141*0Sstevel@tonic-gate #define MAXFRAG 8 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 144*0Sstevel@tonic-gate ((unsigned)(bytes) >> DEV_BSHIFT) 145*0Sstevel@tonic-gate #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 146*0Sstevel@tonic-gate ((unsigned)(db) << DEV_BSHIFT) 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate /* 149*0Sstevel@tonic-gate * Map a ``block device block'' to a file system block. 150*0Sstevel@tonic-gate * XXX - this is currently only being used for tape drives. 151*0Sstevel@tonic-gate */ 152*0Sstevel@tonic-gate #define BLKDEV_IOSIZE 2048 153*0Sstevel@tonic-gate #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate /* 156*0Sstevel@tonic-gate * MAXPATHLEN defines the longest permissable path length, 157*0Sstevel@tonic-gate * including the terminating null, after expanding symbolic links. 158*0Sstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links 159*0Sstevel@tonic-gate * that may be expanded in a path name. It should be set high 160*0Sstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops 161*0Sstevel@tonic-gate * reasonably quickly. 162*0Sstevel@tonic-gate */ 163*0Sstevel@tonic-gate #define MAXPATHLEN 1024 164*0Sstevel@tonic-gate #define MAXSYMLINKS 20 165*0Sstevel@tonic-gate 166*0Sstevel@tonic-gate /* 167*0Sstevel@tonic-gate * bit map related macros 168*0Sstevel@tonic-gate */ 169*0Sstevel@tonic-gate #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) 170*0Sstevel@tonic-gate #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) 171*0Sstevel@tonic-gate #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) 172*0Sstevel@tonic-gate #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate /* 175*0Sstevel@tonic-gate * Macros for fast min/max. 176*0Sstevel@tonic-gate */ 177*0Sstevel@tonic-gate #ifndef MIN 178*0Sstevel@tonic-gate #define MIN(a,b) (((a)<(b))?(a):(b)) 179*0Sstevel@tonic-gate #endif 180*0Sstevel@tonic-gate #ifndef MAX 181*0Sstevel@tonic-gate #define MAX(a,b) (((a)>(b))?(a):(b)) 182*0Sstevel@tonic-gate #endif 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate /* 185*0Sstevel@tonic-gate * Macros for counting and rounding. 186*0Sstevel@tonic-gate */ 187*0Sstevel@tonic-gate #ifdef sun386 188*0Sstevel@tonic-gate #define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) 189*0Sstevel@tonic-gate #define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y)) 190*0Sstevel@tonic-gate #else 191*0Sstevel@tonic-gate #define howmany(x, y) (((x)+((y)-1))/(y)) 192*0Sstevel@tonic-gate #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 193*0Sstevel@tonic-gate #endif 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate /* 196*0Sstevel@tonic-gate * Scale factor for scaled integers used to count 197*0Sstevel@tonic-gate * %cpu time and load averages. 198*0Sstevel@tonic-gate */ 199*0Sstevel@tonic-gate #define FSHIFT 8 /* bits to right of fixed binary point */ 200*0Sstevel@tonic-gate #define FSCALE (1<<FSHIFT) 201*0Sstevel@tonic-gate 202*0Sstevel@tonic-gate /* 203*0Sstevel@tonic-gate * Maximum size of hostname recognized and stored in the kernel. 204*0Sstevel@tonic-gate */ 205*0Sstevel@tonic-gate #define MAXHOSTNAMELEN 64 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate #endif /* !__sys_param_h */ 208