Chameleon

Chameleon Svn Source Tree

Root/branches/mozodojo/i386/include/sys/_structs.h

1/*
2 * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#include <sys/cdefs.h>
30
31#ifdef __need_ucontext_t
32#ifndef __need_struct_ucontext
33#define __need_struct_ucontext
34#endif /* __need_struct_ucontext */
35#endif /* __need_ucontext_t */
36
37#ifdef __need_ucontext64_t
38#ifndef __need_struct_ucontext64
39#define __need_struct_ucontext64
40#endif /* __need_struct_ucontext64 */
41#endif /* __need_ucontext64_t */
42
43#ifdef __need_struct_ucontext
44#ifndef __need_struct_mcontext
45#define __need_struct_mcontext
46#endif /* __need_struct_mcontext */
47#endif /* __need_struct_ucontext */
48
49#ifdef __need_struct_ucontext64
50#ifndef __need_struct_mcontext64
51#define __need_struct_mcontext64
52#endif /* __need_struct_mcontext64 */
53#endif /* __need_struct_ucontext64 */
54
55#if defined(__need_struct_mcontext) || defined(__need_struct_mcontext64)
56#include <machine/_structs.h>
57#endif /* __need_struct_mcontext || __need_struct_mcontext64 */
58
59#if defined(__need_stack_t) || defined(__need_struct_ucontext) || defined(__need_struct_ucontext64)
60#ifndef __need_struct_sigaltstack
61#define __need_struct_sigaltstack
62#endif /* __need_struct_sigaltstack */
63#endif /* __need_stack_t || __need_struct_ucontext || __need_struct_ucontext64 */
64
65#ifdef __need_struct_sigaltstack
66#undef __need_struct_sigaltstack
67/* Structure used in sigaltstack call. */
68#ifndef _STRUCT_SIGALTSTACK
69#if __DARWIN_UNIX03
70#define _STRUCT_SIGALTSTACKstruct __darwin_sigaltstack
71#else /* !__DARWIN_UNIX03 */
72#define _STRUCT_SIGALTSTACKstruct sigaltstack
73#endif /* __DARWIN_UNIX03 */
74_STRUCT_SIGALTSTACK
75{
76void*ss_sp;/* signal stack base */
77__darwin_size_t ss_size;/* signal stack length */
78intss_flags;/* SA_DISABLE and/or SA_ONSTACK */
79};
80#endif /* _STRUCT_SIGALTSTACK */
81#endif /* __need_struct_sigaltstack */
82
83#ifdef __need_struct_timespec
84#undef __need_struct_timespec
85#ifndef _STRUCT_TIMESPEC
86#define _STRUCT_TIMESPECstruct timespec
87_STRUCT_TIMESPEC
88{
89__darwin_time_ttv_sec;
90longtv_nsec;
91};
92#endif /* _STRUCT_TIMESPEC */
93#endif /* __need_struct_timespec */
94
95#ifdef __need_struct_timeval
96#undef __need_struct_timeval
97#ifndef _STRUCT_TIMEVAL
98#define _STRUCT_TIMEVALstruct timeval
99_STRUCT_TIMEVAL
100{
101__darwin_time_ttv_sec;/* seconds */
102__darwin_suseconds_ttv_usec;/* and microseconds */
103};
104#endif /* _STRUCT_TIMEVAL */
105#endif /* __need_struct_timeval */
106
107#ifdef __need_struct_timeval32
108#undef __need_struct_timeval32
109#ifndef _STRUCT_TIMEVAL32
110#define _STRUCT_TIMEVAL32struct timeval32
111_STRUCT_TIMEVAL32
112{
113__int32_ttv_sec;/* seconds */
114__int32_ttv_usec;/* and microseconds */
115};
116#endif /* _STRUCT_TIMEVAL32 */
117#endif /* __need_struct_timeval32 */
118
119#ifdef __need_struct_ucontext
120#undef __need_struct_ucontext
121#ifndef _STRUCT_UCONTEXT
122#if __DARWIN_UNIX03
123#define _STRUCT_UCONTEXTstruct __darwin_ucontext
124#else /* !__DARWIN_UNIX03 */
125#define _STRUCT_UCONTEXTstruct ucontext
126#endif /* __DARWIN_UNIX03 */
127_STRUCT_UCONTEXT
128{
129intuc_onstack;
130__darwin_sigset_tuc_sigmask;/* signal mask used by this context */
131_STRUCT_SIGALTSTACK uc_stack;/* stack used by this context */
132_STRUCT_UCONTEXT*uc_link;/* pointer to resuming context */
133__darwin_size_tuc_mcsize;/* size of the machine context passed in */
134_STRUCT_MCONTEXT*uc_mcontext;/* pointer to machine specific context */
135#ifdef _XOPEN_SOURCE
136_STRUCT_MCONTEXT__mcontext_data;
137#endif /* _XOPEN_SOURCE */
138};
139#endif /* _STRUCT_UCONTEXT */
140#endif /* __need_struct_ucontext */
141
142#ifdef __need_struct_ucontext64
143#undef __need_struct_ucontext64
144#ifndef _STRUCT_UCONTEXT64
145#if __DARWIN_UNIX03
146#define _STRUCT_UCONTEXT64struct __darwin_ucontext64
147#else /* !__DARWIN_UNIX03 */
148#define _STRUCT_UCONTEXT64struct ucontext64
149#endif /* __DARWIN_UNIX03 */
150_STRUCT_UCONTEXT64
151{
152intuc_onstack;
153__darwin_sigset_tuc_sigmask;/* signal mask used by this context */
154_STRUCT_SIGALTSTACK uc_stack;/* stack used by this context */
155_STRUCT_UCONTEXT64*uc_link;/* pointer to resuming context */
156__darwin_size_tuc_mcsize;/* size of the machine context passed in */
157_STRUCT_MCONTEXT64*uc_mcontext64;/* pointer to machine specific context */
158};
159#endif /* _STRUCT_UCONTEXT64 */
160#endif /* __need_struct_ucontext64 */
161
162
163#ifdef __need_fd_set
164#undef __need_fd_set
165#ifndef _FD_SET
166#define _FD_SET
167/*
168 * Select uses bit masks of file descriptors in longs. These macros
169 * manipulate such bit fields (the filesystem macros use chars). The
170 * extra protection here is to permit application redefinition above
171 * the default size.
172 */
173#ifdef FD_SETSIZE
174#define__DARWIN_FD_SETSIZEFD_SETSIZE
175#else /* !FD_SETSIZE */
176#define__DARWIN_FD_SETSIZE1024
177#endif /* FD_SETSIZE */
178#define__DARWIN_NBBY8/* bits in a byte */
179#define __DARWIN_NFDBITS(sizeof(__int32_t) * __DARWIN_NBBY) /* bits per mask */
180#define__DARWIN_howmany(x, y)((((x) % (y)) == 0) ? ((x) / (y)) : (((x) / (y)) + 1)) /* # y's == x bits? */
181
182__BEGIN_DECLS
183typedefstruct fd_set {
184__int32_tfds_bits[__DARWIN_howmany(__DARWIN_FD_SETSIZE, __DARWIN_NFDBITS)];
185} fd_set;
186__END_DECLS
187
188/* This inline avoids argument side-effect issues with FD_ISSET() */
189static __inline int
190__darwin_fd_isset(int _n, const struct fd_set *_p)
191{
192return (_p->fds_bits[_n/__DARWIN_NFDBITS] & (1<<(_n % __DARWIN_NFDBITS)));
193}
194
195#define__DARWIN_FD_SET(n, p)do { int __fd = (n); ((p)->fds_bits[__fd/__DARWIN_NFDBITS] |= (1<<(__fd % __DARWIN_NFDBITS))); } while(0)
196#define__DARWIN_FD_CLR(n, p)do { int __fd = (n); ((p)->fds_bits[__fd/__DARWIN_NFDBITS] &= ~(1<<(__fd % __DARWIN_NFDBITS))); } while(0)
197#define__DARWIN_FD_ISSET(n, p)__darwin_fd_isset((n), (p))
198
199#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3
200/*
201 * Use the built-in bzero function instead of the library version so that
202 * we do not pollute the namespace or introduce prototype warnings.
203 */
204#define__DARWIN_FD_ZERO(p)__builtin_bzero(p, sizeof(*(p)))
205#else
206#define__DARWIN_FD_ZERO(p)bzero(p, sizeof(*(p)))
207#endif
208
209#define__DARWIN_FD_COPY(f, t)bcopy(f, t, sizeof(*(f)))
210#endif /* _FD_SET */
211#endif /* __need_fd_set */
212
213#ifdef __need_stack_t
214#undef __need_stack_t
215#ifndef _STACK_T
216#define _STACK_T
217typedef _STRUCT_SIGALTSTACKstack_t; /* [???] signal stack */
218#endif /* _STACK_T */
219#endif /* __need_stack_t */
220
221#ifdef __need_ucontext_t
222#undef __need_ucontext_t
223/* user context */
224#ifndef _UCONTEXT_T
225#define _UCONTEXT_T
226typedef _STRUCT_UCONTEXTucontext_t;/* [???] user context */
227#endif /* _UCONTEXT_T */
228#endif /* __need_ucontext_t */
229
230#ifdef __need_ucontext64_t
231#undef __need_ucontext64_t
232#ifndef _UCONTEXT64_T
233#define _UCONTEXT64_T
234typedef _STRUCT_UCONTEXT64ucontext64_t;/* [???] user context */
235#endif /* _UCONTEXT64_T */
236#endif /* __need_ucontext64_t */
237

Archive Download this file

Revision: 1232