Annotation of prex-old/include/sys/types.h, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 1982, 1986, 1991, 1993, 1994
! 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: * @(#)types.h 8.6 (Berkeley) 2/19/95
! 35: */
! 36:
! 37: #ifndef _SYS_TYPES_H_
! 38: #define _SYS_TYPES_H_
! 39:
! 40: /* Machine type dependent parameters. */
! 41: #include <machine/ansi.h>
! 42: #include <machine/types.h>
! 43: #include <prex/types.h>
! 44:
! 45: typedef unsigned char u_char;
! 46: typedef unsigned short u_short;
! 47: typedef unsigned int u_int;
! 48: typedef unsigned long u_long;
! 49: typedef unsigned short ushort; /* Sys V compatibility */
! 50: typedef unsigned int uint; /* Sys V compatibility */
! 51:
! 52: typedef uint32_t dev_t; /* device number */
! 53: typedef uint32_t gid_t; /* group id */
! 54: typedef uint32_t ino_t; /* inode number */
! 55: typedef uint16_t mode_t; /* permissions */
! 56: typedef uint16_t nlink_t; /* link count */
! 57: typedef int32_t off_t; /* file offset */
! 58: typedef int32_t pid_t; /* process id */
! 59: typedef uint32_t uid_t; /* user id */
! 60: typedef unsigned long rlim_t; /* resource limit */
! 61:
! 62: #include <sys/endian.h>
! 63:
! 64: #ifdef _BSD_CLOCK_T_
! 65: typedef _BSD_CLOCK_T_ clock_t;
! 66: #undef _BSD_CLOCK_T_
! 67: #endif
! 68:
! 69: #ifdef _BSD_SIZE_T_
! 70: typedef _BSD_SIZE_T_ size_t;
! 71: #undef _BSD_SIZE_T_
! 72: #endif
! 73:
! 74: #ifdef _BSD_SSIZE_T_
! 75: typedef _BSD_SSIZE_T_ ssize_t;
! 76: #undef _BSD_SSIZE_T_
! 77: #endif
! 78:
! 79: #ifdef _BSD_TIME_T_
! 80: typedef _BSD_TIME_T_ time_t;
! 81: #undef _BSD_TIME_T_
! 82: #endif
! 83:
! 84: #ifndef _POSIX_SOURCE
! 85: #define NBBY 8 /* number of bits in a byte */
! 86:
! 87: /*
! 88: * Select uses bit masks of file descriptors in longs. These macros
! 89: * manipulate such bit fields (the filesystem macros use chars).
! 90: * FD_SETSIZE may be defined by the user, but the default here should
! 91: * be enough for most uses.
! 92: */
! 93: #ifndef FD_SETSIZE
! 94: #define FD_SETSIZE 16
! 95: #endif
! 96:
! 97: typedef int32_t fd_mask;
! 98: #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
! 99:
! 100: #ifndef howmany
! 101: #define howmany(x, y) (((x) + ((y) - 1)) / (y))
! 102: #endif
! 103:
! 104: typedef struct fd_set {
! 105: fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
! 106: } fd_set;
! 107:
! 108: #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
! 109: #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
! 110: #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
! 111: #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
! 112: #define FD_ZERO(p) bzero(p, sizeof(*(p)))
! 113:
! 114: #if defined(__STDC__) && defined(KERNEL)
! 115: /*
! 116: * Forward structure declarations for function prototypes. We include the
! 117: * common structures that cross subsystem boundaries here; others are mostly
! 118: * used in the same place that the structure is defined.
! 119: */
! 120: struct pgrp;
! 121: struct rusage;
! 122: struct file;
! 123: struct buf;
! 124: struct tty;
! 125: #endif
! 126:
! 127: #endif /* !_POSIX_SOURCE */
! 128: #endif /* !_SYS_TYPES_H_ */
CVSweb