Annotation of prex/include/sys/types.h, Revision 1.1.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/types.h>
42: #include <prex/types.h>
43:
44: typedef unsigned char u_char;
45: typedef unsigned short u_short;
46: typedef unsigned int u_int;
47: typedef unsigned long u_long;
48:
49: typedef uint32_t dev_t; /* device number */
50: typedef uint32_t gid_t; /* group id */
51: typedef uint32_t ino_t; /* inode number */
52: typedef uint16_t mode_t; /* permissions */
53: typedef uint16_t nlink_t; /* link count */
54: typedef int32_t off_t; /* file offset */
55: typedef int32_t pid_t; /* process id */
56: typedef uint32_t uid_t; /* user id */
57: typedef unsigned long rlim_t; /* resource limit */
58:
59: #include <sys/endian.h>
60:
61: #if !defined(_CLOCK_T)
62: #define _CLOCK_T
63: typedef unsigned long clock_t; /* relative time in a specified resolution */
64: #endif
65:
66: #if !defined(_SIZE_T)
67: #define _SIZE_T
68: typedef unsigned int size_t; /* size of something in bytes */
69: #endif
70:
71: #if !defined(_SSIZE_T)
72: #define _SSIZE_T
73: typedef int ssize_t; /* size of something in bytes */
74: #endif
75:
76: #if !defined(_TIME_T)
77: #define _TIME_T
78: typedef long time_t; /* time of day in seconds */
79: #endif
80:
81: #define NBBY 8 /* number of bits in a byte */
82:
83: #ifndef KERNEL
84: /*
85: * Select uses bit masks of file descriptors in longs. These macros
86: * manipulate such bit fields (the filesystem macros use chars).
87: * FD_SETSIZE may be defined by the user, but the default here should
88: * be enough for most uses.
89: */
90: #ifndef FD_SETSIZE
91: #define FD_SETSIZE 16
92: #endif
93:
94: typedef int32_t fd_mask;
95: #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
96:
97: #ifndef howmany
98: #define howmany(x, y) (((x) + ((y) - 1)) / (y))
99: #endif
100:
101: typedef struct fd_set {
102: fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
103: } fd_set;
104:
105: #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
106: #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
107: #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
108: #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
109: #define FD_ZERO(p) bzero(p, sizeof(*(p)))
110: #endif /* !KERNEL */
111:
112: #endif /* !_SYS_TYPES_H_ */
CVSweb