Annotation of prex/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: #ifndef LOCORE
! 40: #include <sys/types.h>
! 41: #endif
! 42:
! 43: /*
! 44: * Machine-independent constants (some used in following include files).
! 45: * Redefined constants are from POSIX 1003.1 limits file.
! 46: *
! 47: * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
! 48: * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
! 49: */
! 50: #include <sys/syslimits.h>
! 51:
! 52: #define MAXCOMLEN 16 /* max command name remembered */
! 53: #define MAXINTERP 32 /* max interpreter file name length */
! 54: #define MAXLOGNAME 12 /* max login name length */
! 55: #define MAXUPRC CHILD_MAX /* max simultaneous processes */
! 56: #define NCARGS ARG_MAX /* max bytes for an exec function */
! 57: #define NGROUPS NGROUPS_MAX /* max number groups */
! 58: #define NOFILE OPEN_MAX /* max open files per process */
! 59: #define NOGROUP 65535 /* marker for empty group set member */
! 60: #define MAXHOSTNAMELEN 32 /* max hostname size */
! 61:
! 62: /* The following name length include a null-terminate charcter */
! 63: #define MAXTASKNAME 12 /* max task name */
! 64: #define MAXDEVNAME 12 /* max device name */
! 65: #define MAXOBJNAME 16 /* max object name */
! 66: #define MAXEVTNAME 12 /* max event name */
! 67:
! 68: #define HZ CONFIG_HZ /* ticks per second */
! 69: #define PAGE_SIZE CONFIG_PAGE_SIZE
! 70: #define KSTACK_SIZE CONFIG_KSTACK_SIZE /* kernel stack size */
! 71: #define USTACK_SIZE CONFIG_USTACK_SIZE /* user stack size */
! 72:
! 73: #ifndef NULL
! 74: #if !defined(__cplusplus)
! 75: #define NULL ((void *)0)
! 76: #else
! 77: #define NULL 0
! 78: #endif
! 79: #endif
! 80:
! 81: /* More types and definitions used throughout the kernel. */
! 82: #ifdef KERNEL
! 83: #include <sys/cdefs.h>
! 84: #endif
! 85:
! 86: #ifndef KERNEL
! 87: /* Signals. */
! 88: #include <sys/signal.h>
! 89: #endif
! 90:
! 91: #include <machine/limits.h>
! 92:
! 93: /*
! 94: * Round p (pointer or byte index) up to a correctly-aligned value for all
! 95: * data types (int, long, ...). The result is u_long and must be cast to
! 96: * any desired pointer type.
! 97: */
! 98: #define ALIGNBYTES 3
! 99: #define ALIGN(p) (((vaddr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
! 100:
! 101: /*
! 102: * Memory page
! 103: */
! 104: #define PAGE_MASK (PAGE_SIZE-1)
! 105:
! 106: #define PAGE_ALIGN(n) ((((vaddr_t)(n)) + PAGE_MASK) & (vaddr_t)~PAGE_MASK)
! 107:
! 108: #define PAGE_TRUNC(n) (((vaddr_t)(n)) & (vaddr_t)~PAGE_MASK)
! 109:
! 110: /*
! 111: * MAXPATHLEN defines the longest permissable path length after expanding
! 112: * symbolic links. It is used to allocate a temporary buffer from the buffer
! 113: * pool in which to do the name expansion, hence should be a power of two,
! 114: * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
! 115: * maximum number of symbolic links that may be expanded in a path name.
! 116: * It should be set high enough to allow all legitimate uses, but halt
! 117: * infinite loops reasonably quickly.
! 118: */
! 119: #define MAXPATHLEN PATH_MAX
! 120: #define MAXSYMLINKS 8
! 121:
! 122: /* Bit map related macros. */
! 123: #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
! 124: #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
! 125: #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
! 126: #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
! 127:
! 128: /* Macros for counting and rounding. */
! 129: #ifndef howmany
! 130: #define howmany(x, y) (((x)+((y)-1))/(y))
! 131: #endif
! 132: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
! 133: #define powerof2(x) ((((x)-1)&(x))==0)
! 134:
! 135: /* Macros for min/max. */
! 136: #ifndef KERNEL
! 137: #define MIN(a,b) (((a)<(b))?(a):(b))
! 138: #define MAX(a,b) (((a)>(b))?(a):(b))
! 139: #endif
! 140:
! 141: #define BSIZE 512 /* size of secondary block (bytes) */
CVSweb