root / prex-0.9.0 / include / sys / types.h @ 03e9c04a
History | View | Annotate | Download (4.44 KB)
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 |
|
43 |
typedef unsigned char u_char; |
44 |
typedef unsigned short u_short; |
45 |
typedef unsigned int u_int; |
46 |
typedef unsigned long u_long; |
47 |
|
48 |
typedef uint32_t dev_t; /* device number */ |
49 |
typedef uint32_t gid_t; /* group id */ |
50 |
typedef uint32_t ino_t; /* inode number */ |
51 |
typedef uint32_t mode_t; /* permissions */ |
52 |
typedef uint32_t nlink_t; /* link count */ |
53 |
typedef int32_t off_t; /* file offset */ |
54 |
typedef int32_t pid_t; /* process id */ |
55 |
typedef uint32_t uid_t; /* user id */ |
56 |
typedef unsigned long rlim_t; /* resource limit */ |
57 |
|
58 |
#ifndef KERNEL
|
59 |
typedef unsigned long object_t; |
60 |
typedef unsigned long task_t; |
61 |
typedef unsigned long thread_t; |
62 |
typedef unsigned long mutex_t; |
63 |
typedef unsigned long cond_t; |
64 |
typedef unsigned long sem_t; |
65 |
typedef unsigned long device_t; |
66 |
#endif /* KERNEL */ |
67 |
|
68 |
#define OBJECT_NULL ((object_t)0) |
69 |
#define TASK_NULL ((task_t)0) |
70 |
#define THREAD_NULL ((thread_t)0) |
71 |
#define MUTEX_NULL ((mutex_t)0) |
72 |
#define COND_NULL ((cond_t)0) |
73 |
#define SEM_NULL ((sem_t)0) |
74 |
#define NODEV ((device_t)0) |
75 |
|
76 |
#ifdef KERNEL
|
77 |
typedef void (*dkifn_t)(void); |
78 |
#endif
|
79 |
|
80 |
#include <sys/endian.h> |
81 |
|
82 |
#if !defined(_CLOCK_T)
|
83 |
#define _CLOCK_T
|
84 |
typedef unsigned long clock_t; /* relative time in a specified resolution */ |
85 |
#endif
|
86 |
|
87 |
#if !defined(_SIZE_T)
|
88 |
#define _SIZE_T
|
89 |
typedef unsigned int size_t; /* size of something in bytes */ |
90 |
#endif
|
91 |
|
92 |
#if !defined(_SSIZE_T)
|
93 |
#define _SSIZE_T
|
94 |
typedef int ssize_t; /* size of something in bytes */ |
95 |
#endif
|
96 |
|
97 |
#if !defined(_TIME_T)
|
98 |
#define _TIME_T
|
99 |
typedef long time_t; /* time of day in seconds */ |
100 |
#endif
|
101 |
|
102 |
#define NBBY 8 /* number of bits in a byte */ |
103 |
|
104 |
#ifndef KERNEL
|
105 |
/*
|
106 |
* Select uses bit masks of file descriptors in longs. These macros
|
107 |
* manipulate such bit fields (the filesystem macros use chars).
|
108 |
* FD_SETSIZE may be defined by the user, but the default here should
|
109 |
* be enough for most uses.
|
110 |
*/
|
111 |
#ifndef FD_SETSIZE
|
112 |
#define FD_SETSIZE 16 |
113 |
#endif
|
114 |
|
115 |
typedef int32_t fd_mask;
|
116 |
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ |
117 |
|
118 |
#ifndef howmany
|
119 |
#define howmany(x, y) (((x) + ((y) - 1)) / (y)) |
120 |
#endif
|
121 |
|
122 |
typedef struct fd_set { |
123 |
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; |
124 |
} fd_set; |
125 |
|
126 |
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) |
127 |
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) |
128 |
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) |
129 |
#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) |
130 |
#define FD_ZERO(p) bzero(p, sizeof(*(p))) |
131 |
#endif /* !KERNEL */ |
132 |
|
133 |
#endif /* !_SYS_TYPES_H_ */ |