]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
9bccf70c | 2 | * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
23 | /*- | |
24 | * Copyright (c) 1982, 1986, 1991, 1993, 1994 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * (c) UNIX System Laboratories, Inc. | |
27 | * All or some portions of this file are derived from material licensed | |
28 | * to the University of California by American Telephone and Telegraph | |
29 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
30 | * the permission of UNIX System Laboratories, Inc. | |
31 | * | |
32 | * Redistribution and use in source and binary forms, with or without | |
33 | * modification, are permitted provided that the following conditions | |
34 | * are met: | |
35 | * 1. Redistributions of source code must retain the above copyright | |
36 | * notice, this list of conditions and the following disclaimer. | |
37 | * 2. Redistributions in binary form must reproduce the above copyright | |
38 | * notice, this list of conditions and the following disclaimer in the | |
39 | * documentation and/or other materials provided with the distribution. | |
40 | * 3. All advertising materials mentioning features or use of this software | |
41 | * must display the following acknowledgement: | |
42 | * This product includes software developed by the University of | |
43 | * California, Berkeley and its contributors. | |
44 | * 4. Neither the name of the University nor the names of its contributors | |
45 | * may be used to endorse or promote products derived from this software | |
46 | * without specific prior written permission. | |
47 | * | |
48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | |
59 | * | |
60 | * @(#)types.h 8.4 (Berkeley) 1/21/94 | |
61 | */ | |
62 | ||
63 | #ifndef _SYS_TYPES_H_ | |
64 | #define _SYS_TYPES_H_ | |
65 | ||
9bccf70c A |
66 | #include <sys/appleapiopts.h> |
67 | ||
1c79356b A |
68 | #ifndef __ASSEMBLER__ |
69 | #include <sys/cdefs.h> | |
70 | ||
71 | /* Machine type dependent parameters. */ | |
72 | #include <machine/types.h> | |
73 | ||
74 | #include <machine/ansi.h> | |
75 | #include <machine/endian.h> | |
76 | ||
77 | #ifndef _POSIX_SOURCE | |
78 | typedef unsigned char u_char; | |
79 | typedef unsigned short u_short; | |
80 | typedef unsigned int u_int; | |
81 | typedef unsigned long u_long; | |
82 | typedef unsigned short ushort; /* Sys V compatibility */ | |
83 | typedef unsigned int uint; /* Sys V compatibility */ | |
84 | #endif | |
85 | ||
86 | typedef u_int64_t u_quad_t; /* quads */ | |
87 | typedef int64_t quad_t; | |
88 | typedef quad_t * qaddr_t; | |
89 | ||
90 | typedef char * caddr_t; /* core address */ | |
91 | typedef int32_t daddr_t; /* disk address */ | |
92 | typedef int32_t dev_t; /* device number */ | |
93 | typedef u_int32_t fixpt_t; /* fixed point number */ | |
94 | typedef u_int32_t gid_t; /* group id */ | |
9bccf70c A |
95 | typedef u_int32_t in_addr_t; /* base type for internet address */ |
96 | typedef u_int16_t in_port_t; | |
1c79356b A |
97 | typedef u_int32_t ino_t; /* inode number */ |
98 | typedef long key_t; /* IPC key (for Sys V IPC) */ | |
99 | typedef u_int16_t mode_t; /* permissions */ | |
100 | typedef u_int16_t nlink_t; /* link count */ | |
101 | typedef quad_t off_t; /* file offset */ | |
102 | typedef int32_t pid_t; /* process id */ | |
103 | typedef quad_t rlim_t; /* resource limit */ | |
104 | typedef int32_t segsz_t; /* segment size */ | |
105 | typedef int32_t swblk_t; /* swap offset */ | |
106 | typedef u_int32_t uid_t; /* user id */ | |
107 | ||
1c79356b A |
108 | #ifndef _POSIX_SOURCE |
109 | /* Major, minor numbers, dev_t's. */ | |
110 | #define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff)) | |
111 | #define minor(x) ((int32_t)((x) & 0xffffff)) | |
112 | #define makedev(x,y) ((dev_t)(((x) << 24) | (y))) | |
113 | #endif | |
114 | ||
115 | #ifndef _BSD_CLOCK_T_DEFINED_ | |
116 | #define _BSD_CLOCK_T_DEFINED_ | |
117 | typedef _BSD_CLOCK_T_ clock_t; | |
118 | #endif | |
119 | ||
120 | #ifndef _BSD_SIZE_T_DEFINED_ | |
121 | #define _BSD_SIZE_T_DEFINED_ | |
122 | typedef _BSD_SIZE_T_ size_t; | |
123 | #endif | |
124 | ||
125 | #ifndef _BSD_SSIZE_T_DEFINED_ | |
126 | #define _BSD_SSIZE_T_DEFINED_ | |
127 | typedef _BSD_SSIZE_T_ ssize_t; | |
128 | #endif | |
129 | ||
130 | #ifndef _BSD_TIME_T_DEFINED_ | |
131 | #define _BSD_TIME_T_DEFINED_ | |
132 | typedef _BSD_TIME_T_ time_t; | |
133 | #endif | |
134 | ||
135 | #ifndef _POSIX_SOURCE | |
136 | #define NBBY 8 /* number of bits in a byte */ | |
137 | ||
138 | /* | |
139 | * Select uses bit masks of file descriptors in longs. These macros | |
140 | * manipulate such bit fields (the filesystem macros use chars). | |
141 | */ | |
142 | #ifndef FD_SETSIZE | |
0b4e3aa0 | 143 | #define FD_SETSIZE 1024 |
1c79356b A |
144 | #endif |
145 | ||
146 | typedef int32_t fd_mask; | |
147 | #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ | |
148 | ||
149 | #ifndef howmany | |
150 | #define howmany(x, y) (((x) + ((y) - 1)) / (y)) | |
151 | #endif | |
152 | ||
153 | typedef struct fd_set { | |
154 | fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; | |
155 | } fd_set; | |
156 | ||
157 | #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) | |
158 | #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) | |
159 | #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) | |
160 | #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) | |
161 | #define FD_ZERO(p) bzero(p, sizeof(*(p))) | |
162 | ||
163 | #if defined(__STDC__) && defined(KERNEL) | |
164 | /* | |
165 | * Forward structure declarations for function prototypes. We include the | |
166 | * common structures that cross subsystem boundaries here; others are mostly | |
167 | * used in the same place that the structure is defined. | |
168 | */ | |
169 | struct proc; | |
170 | struct pgrp; | |
171 | struct ucred; | |
172 | struct rusage; | |
173 | struct file; | |
174 | struct buf; | |
175 | struct tty; | |
176 | struct uio; | |
177 | #endif | |
178 | ||
179 | #endif /* !_POSIX_SOURCE */ | |
180 | #endif /* __ASSEMBLER__ */ | |
181 | ||
182 | struct _pthread_handler_rec | |
183 | { | |
184 | void (*routine)(void *); /* Routine to call */ | |
185 | void *arg; /* Argument to pass */ | |
186 | struct _pthread_handler_rec *next; | |
187 | }; | |
188 | ||
189 | #ifndef __POSIX_LIB__ | |
190 | ||
191 | #define __PTHREAD_SIZE__ 596 | |
192 | #define __PTHREAD_ATTR_SIZE__ 36 | |
193 | #define __PTHREAD_MUTEXATTR_SIZE__ 8 | |
194 | #define __PTHREAD_MUTEX_SIZE__ 40 | |
195 | #define __PTHREAD_CONDATTR_SIZE__ 4 | |
196 | #define __PTHREAD_COND_SIZE__ 24 | |
197 | #define __PTHREAD_ONCE_SIZE__ 4 | |
9bccf70c A |
198 | #define __PTHREAD_RWLOCK_SIZE__ 124 |
199 | #define __PTHREAD_RWLOCKATTR_SIZE__ 12 | |
1c79356b A |
200 | |
201 | ||
202 | typedef struct _opaque_pthread_t { long sig; struct _pthread_handler_rec *cleanup_stack; char opaque[__PTHREAD_SIZE__];} *pthread_t; | |
203 | ||
204 | typedef struct _opaque_pthread_attr_t { long sig; char opaque[__PTHREAD_ATTR_SIZE__]; } pthread_attr_t; | |
205 | ||
206 | typedef struct _opaque_pthread_mutexattr_t { long sig; char opaque[__PTHREAD_MUTEXATTR_SIZE__]; } pthread_mutexattr_t; | |
207 | ||
208 | typedef struct _opaque_pthread_mutex_t { long sig; char opaque[__PTHREAD_MUTEX_SIZE__]; } pthread_mutex_t; | |
209 | ||
210 | typedef struct _opaque_pthread_condattr_t { long sig; char opaque[__PTHREAD_CONDATTR_SIZE__]; } pthread_condattr_t; | |
211 | ||
212 | typedef struct _opaque_pthread_cond_t { long sig; char opaque[__PTHREAD_COND_SIZE__]; } pthread_cond_t; | |
213 | ||
9bccf70c A |
214 | typedef struct _opaque_pthread_rwlockattr_t { long sig; char opaque[__PTHREAD_RWLOCKATTR_SIZE__]; } pthread_rwlockattr_t; |
215 | ||
216 | typedef struct _opaque_pthread_rwlock_t { long sig; char opaque[__PTHREAD_RWLOCK_SIZE__]; } pthread_rwlock_t; | |
217 | ||
1c79356b A |
218 | typedef struct { long sig; char opaque[__PTHREAD_ONCE_SIZE__]; } pthread_once_t; |
219 | ||
220 | #endif /* __POSIX_LIB__ */ | |
221 | ||
222 | typedef unsigned long pthread_key_t; /* Opaque 'pointer' */ | |
223 | ||
224 | #endif /* !_SYS_TYPES_H_ */ |