Annotation of prex-old/include/sys/param.h, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 1982, 1986, 1989, 1993
! 3: * The Regents of the University of California. All rights reserved.
! 4: * (c) UNIX System Laboratories, Inc.
! 5: * All or some portions of this file are derived from material licensed
! 6: * to the University of California by American Telephone and Telegraph
! 7: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
! 8: * the permission of UNIX System Laboratories, Inc.
! 9: *
! 10: * Redistribution and use in source and binary forms, with or without
! 11: * modification, are permitted provided that the following conditions
! 12: * are met:
! 13: * 1. Redistributions of source code must retain the above copyright
! 14: * notice, this list of conditions and the following disclaimer.
! 15: * 2. Redistributions in binary form must reproduce the above copyright
! 16: * notice, this list of conditions and the following disclaimer in the
! 17: * documentation and/or other materials provided with the distribution.
! 18: * 3. Neither the name of the University nor the names of its contributors
! 19: * may be used to endorse or promote products derived from this software
! 20: * without specific prior written permission.
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 32: * SUCH DAMAGE.
! 33: *
! 34: * @(#)param.h 8.3 (Berkeley) 4/4/95
! 35: */
! 36:
! 37: #include <conf/config.h>
! 38:
! 39: #define BSD 199506 /* System version (year & month). */
! 40: #define BSD4_3 1
! 41: #define BSD4_4 1
! 42:
! 43: #include <sys/null.h>
! 44:
! 45: #ifndef LOCORE
! 46: #include <sys/types.h>
! 47: #endif
! 48:
! 49: /*
! 50: * Machine-independent constants (some used in following include files).
! 51: * Redefined constants are from POSIX 1003.1 limits file.
! 52: *
! 53: * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
! 54: * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
! 55: */
! 56: #include <sys/syslimits.h>
! 57:
! 58: #define MAXCOMLEN 16 /* max command name remembered */
! 59: #define MAXINTERP 32 /* max interpreter file name length */
! 60: #define MAXLOGNAME 12 /* max login name length */
! 61: #define MAXUPRC CHILD_MAX /* max simultaneous processes */
! 62: #define NCARGS ARG_MAX /* max bytes for an exec function */
! 63: #define NGROUPS NGROUPS_MAX /* max number groups */
! 64: #define NOFILE OPEN_MAX /* max open files per process */
! 65: #define NOGROUP 65535 /* marker for empty group set member */
! 66: #define MAXHOSTNAMELEN 32 /* max hostname size */
! 67:
! 68: #define MAXTASKNAME 12 /* max task name */
! 69: #define MAXDEVNAME 12 /* max device name */
! 70: #define MAXOBJNAME 16 /* max object name */
! 71: #define MAXEVTNAME 12 /* max event name */
! 72:
! 73: #define HZ CONFIG_HZ /* ticks per second */
! 74: #define PAGE_SIZE CONFIG_PAGE_SIZE
! 75: #define KSTACK_SIZE CONFIG_KSTACK_SIZE /* kernel stack size */
! 76: #define USTACK_SIZE CONFIG_USTACK_SIZE /* user stack size */
! 77:
! 78: /* More types and definitions used throughout the kernel. */
! 79: #ifdef KERNEL
! 80: #include <sys/cdefs.h>
! 81: #include <sys/errno.h>
! 82: #endif
! 83:
! 84: #ifndef KERNEL
! 85: /* Signals. */
! 86: #include <sys/signal.h>
! 87: #endif
! 88:
! 89: #include <machine/limits.h>
! 90:
! 91: /*
! 92: * Round p (pointer or byte index) up to a correctly-aligned value for all
! 93: * data types (int, long, ...). The result is u_int and must be cast to
! 94: * any desired pointer type.
! 95: */
! 96: #define ALIGNBYTES 3
! 97: #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
! 98:
! 99: /*
! 100: * Memory page
! 101: */
! 102: #define PAGE_MASK (PAGE_SIZE-1)
! 103: #define PAGE_ALIGN(n) ((((u_long)(n)) + PAGE_MASK) & ~PAGE_MASK)
! 104: #define PAGE_TRUNC(n) (((u_long)(n)) & ~PAGE_MASK)
! 105:
! 106: /*
! 107: * MAXPATHLEN defines the longest permissable path length after expanding
! 108: * symbolic links. It is used to allocate a temporary buffer from the buffer
! 109: * pool in which to do the name expansion, hence should be a power of two,
! 110: * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
! 111: * maximum number of symbolic links that may be expanded in a path name.
! 112: * It should be set high enough to allow all legitimate uses, but halt
! 113: * infinite loops reasonably quickly.
! 114: */
! 115: #define MAXPATHLEN PATH_MAX
! 116: #define MAXSYMLINKS 8
! 117:
! 118: /* Bit map related macros. */
! 119: #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
! 120: #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
! 121: #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
! 122: #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
! 123:
! 124: /* Macros for counting and rounding. */
! 125: #ifndef howmany
! 126: #define howmany(x, y) (((x)+((y)-1))/(y))
! 127: #endif
! 128: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
! 129: #define powerof2(x) ((((x)-1)&(x))==0)
! 130:
! 131: /* Macros for min/max. */
! 132: #ifndef KERNEL
! 133: #define MIN(a,b) (((a)<(b))?(a):(b))
! 134: #define MAX(a,b) (((a)>(b))?(a):(b))
! 135: #endif
! 136:
! 137: #define BSIZE 512 /* size of secondary block (bytes) */
CVSweb