Ticket #33300: unistd.h

File unistd.h, 26.0 KB (added by c9s (Yo-An Lin), 12 years ago)

/usr/include/unistd.h

Line 
1/*
2 * Copyright (c) 2000, 2002-2006, 2008-2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*-
24 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
25 * Copyright (c) 1991, 1993, 1994
26 *      The Regents of the University of California.  All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 *    notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 *    notice, this list of conditions and the following disclaimer in the
35 *    documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 *    must display the following acknowledgement:
38 *      This product includes software developed by the University of
39 *      California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 *    may be used to endorse or promote products derived from this software
42 *    without specific prior written permission.
43 *
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
54 * SUCH DAMAGE.
55 *
56 *      @(#)unistd.h    8.12 (Berkeley) 4/27/95
57 *
58 *  Copyright (c)  1998 Apple Compter, Inc.
59 *  All Rights Reserved
60 */
61
62/* History:
63        7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
64        3/26/98 CHW at Apple added real interface to searchfs call
65        3/5/98  CHW at Apple added hfs semantic system calls headers
66*/
67
68#ifndef _UNISTD_H_
69#define _UNISTD_H_
70
71#include <_types.h>
72#include <sys/unistd.h>
73#include <Availability.h>
74
75#ifndef _GID_T
76#define _GID_T
77typedef __darwin_gid_t          gid_t;
78#endif
79
80#ifndef _INTPTR_T
81#define _INTPTR_T
82typedef __darwin_intptr_t       intptr_t;
83#endif
84
85#ifndef _OFF_T
86#define _OFF_T
87typedef __darwin_off_t          off_t;
88#endif
89
90#ifndef _PID_T
91#define _PID_T
92typedef __darwin_pid_t          pid_t;
93#endif
94
95#ifndef _SIZE_T
96#define _SIZE_T
97/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
98 * _GCC_SIZE_T */
99typedef __darwin_size_t         size_t;
100#endif
101
102#ifndef _SSIZE_T
103#define _SSIZE_T
104typedef __darwin_ssize_t        ssize_t;
105#endif
106
107#ifndef _UID_T
108#define _UID_T
109typedef __darwin_uid_t          uid_t;  /* user id      */
110#endif
111
112#ifndef _USECONDS_T
113#define _USECONDS_T
114typedef __darwin_useconds_t     useconds_t;
115#endif
116
117#ifndef NULL
118#define NULL __DARWIN_NULL
119#endif /* ! NULL */
120
121#define  STDIN_FILENO   0       /* standard input file descriptor */
122#define STDOUT_FILENO   1       /* standard output file descriptor */
123#define STDERR_FILENO   2       /* standard error file descriptor */
124
125
126/* Version test macros */
127/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
128#define _XOPEN_VERSION                  600             /* [XSI] */
129#define _XOPEN_XCU_VERSION              4               /* Older standard */
130
131
132/* Please keep this list in the same order as the applicable standard */
133#define _POSIX_ADVISORY_INFO            (-1)            /* [ADV] */
134#define _POSIX_ASYNCHRONOUS_IO          (-1)            /* [AIO] */
135#define _POSIX_BARRIERS                 (-1)            /* [BAR] */
136#define _POSIX_CHOWN_RESTRICTED         200112L
137#define _POSIX_CLOCK_SELECTION          (-1)            /* [CS] */
138#define _POSIX_CPUTIME                  (-1)            /* [CPT] */
139#define _POSIX_FSYNC                    200112L         /* [FSC] */
140#define _POSIX_IPV6                     200112L
141#define _POSIX_JOB_CONTROL              200112L
142#define _POSIX_MAPPED_FILES             200112L         /* [MF] */
143#define _POSIX_MEMLOCK                  (-1)            /* [ML] */
144#define _POSIX_MEMLOCK_RANGE            (-1)            /* [MR] */
145#define _POSIX_MEMORY_PROTECTION        200112L         /* [MPR] */
146#define _POSIX_MESSAGE_PASSING          (-1)            /* [MSG] */
147#define _POSIX_MONOTONIC_CLOCK          (-1)            /* [MON] */
148#define _POSIX_NO_TRUNC                 200112L
149#define _POSIX_PRIORITIZED_IO           (-1)            /* [PIO] */
150#define _POSIX_PRIORITY_SCHEDULING      (-1)            /* [PS] */
151#define _POSIX_RAW_SOCKETS              (-1)            /* [RS] */
152#define _POSIX_READER_WRITER_LOCKS      200112L         /* [THR] */
153#define _POSIX_REALTIME_SIGNALS         (-1)            /* [RTS] */
154#define _POSIX_REGEXP                   200112L
155#define _POSIX_SAVED_IDS                200112L         /* XXX required */
156#define _POSIX_SEMAPHORES               (-1)            /* [SEM] */
157#define _POSIX_SHARED_MEMORY_OBJECTS    (-1)            /* [SHM] */
158#define _POSIX_SHELL                    200112L
159#define _POSIX_SPAWN                    (-1)            /* [SPN] */
160#define _POSIX_SPIN_LOCKS               (-1)            /* [SPI] */
161#define _POSIX_SPORADIC_SERVER          (-1)            /* [SS] */
162#define _POSIX_SYNCHRONIZED_IO          (-1)            /* [SIO] */
163#define _POSIX_THREAD_ATTR_STACKADDR    200112L         /* [TSA] */
164#define _POSIX_THREAD_ATTR_STACKSIZE    200112L         /* [TSS] */
165#define _POSIX_THREAD_CPUTIME           (-1)            /* [TCT] */
166#define _POSIX_THREAD_PRIO_INHERIT      (-1)            /* [TPI] */
167#define _POSIX_THREAD_PRIO_PROTECT      (-1)            /* [TPP] */
168#define _POSIX_THREAD_PRIORITY_SCHEDULING       (-1)    /* [TPS] */
169#define _POSIX_THREAD_PROCESS_SHARED    200112L         /* [TSH] */
170#define _POSIX_THREAD_SAFE_FUNCTIONS    200112L         /* [TSF] */
171#define _POSIX_THREAD_SPORADIC_SERVER   (-1)            /* [TSP] */
172#define _POSIX_THREADS                  200112L         /* [THR] */
173#define _POSIX_TIMEOUTS                 (-1)            /* [TMO] */
174#define _POSIX_TIMERS                   (-1)            /* [TMR] */
175#define _POSIX_TRACE                    (-1)            /* [TRC] */
176#define _POSIX_TRACE_EVENT_FILTER       (-1)            /* [TEF] */
177#define _POSIX_TRACE_INHERIT            (-1)            /* [TRI] */
178#define _POSIX_TRACE_LOG                (-1)            /* [TRL] */
179#define _POSIX_TYPED_MEMORY_OBJECTS     (-1)            /* [TYM] */
180#ifndef _POSIX_VDISABLE
181#define _POSIX_VDISABLE                 0xff            /* same as sys/termios.h */
182#endif /* _POSIX_VDISABLE */
183
184#if __DARWIN_C_LEVEL >= 199209L
185#define _POSIX2_C_BIND                  200112L
186#define _POSIX2_C_DEV                   200112L         /* c99 command */
187#define _POSIX2_CHAR_TERM               200112L
188#define _POSIX2_FORT_DEV                (-1)            /* fort77 command */
189#define _POSIX2_FORT_RUN                200112L
190#define _POSIX2_LOCALEDEF               200112L         /* localedef command */
191#define _POSIX2_PBS                     (-1)
192#define _POSIX2_PBS_ACCOUNTING          (-1)
193#define _POSIX2_PBS_CHECKPOINT          (-1)
194#define _POSIX2_PBS_LOCATE              (-1)
195#define _POSIX2_PBS_MESSAGE             (-1)
196#define _POSIX2_PBS_TRACK               (-1)
197#define _POSIX2_SW_DEV                  200112L
198#define _POSIX2_UPE                     200112L /* XXXX no fc, newgrp, tabs */
199#endif /* __DARWIN_C_LEVEL */
200
201#define __ILP32_OFF32          (-1)
202#define __ILP32_OFFBIG         (-1)
203#define __LP64_OFF64           (-1)
204#define __LPBIG_OFFBIG         (-1)
205
206#ifdef __LP64__
207#undef __LP64_OFF64
208#define __LP64_OFF64           (1)
209#undef __LPBIG_OFFBIG
210#define __LPBIG_OFFBIG         (1)
211#else
212#undef  __ILP32_OFFBIG
213#define __ILP32_OFFBIG         (1)
214#endif
215
216#if __DARWIN_C_LEVEL >= 200112L
217#define _POSIX_V6_ILP32_OFF32           __ILP32_OFF32
218#define _POSIX_V6_ILP32_OFFBIG          __ILP32_OFFBIG
219#define _POSIX_V6_LP64_OFF64            __LP64_OFF64
220#define _POSIX_V6_LPBIG_OFFBIG          __LPBIG_OFFBIG
221#endif /* __DARWIN_C_LEVEL >= 200112L */
222
223#if __DARWIN_C_LEVEL >= 200809L
224#define _POSIX_V7_ILP32_OFF32           __ILP32_OFF32
225#define _POSIX_V7_ILP32_OFFBIG          __ILP32_OFFBIG
226#define _POSIX_V7_LP64_OFF64            __LP64_OFF64
227#define _POSIX_V7_LPBIG_OFFBIG          __LPBIG_OFFBIG
228#endif /* __DARWIN_C_LEVEL >= 200809L */
229
230#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
231#define _V6_ILP32_OFF32             __ILP32_OFF32
232#define _V6_ILP32_OFFBIG            __ILP32_OFFBIG
233#define _V6_LP64_OFF64              __LP64_OFF64
234#define _V6_LPBIG_OFFBIG            __LPBIG_OFFBIG
235#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
236
237#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
238/* Removed in Issue 7 */
239#define _XBS5_ILP32_OFF32                   __ILP32_OFF32
240#define _XBS5_ILP32_OFFBIG                  __ILP32_OFFBIG
241#define _XBS5_LP64_OFF64                    __LP64_OFF64
242#define _XBS5_LPBIG_OFFBIG                  __LPBIG_OFFBIG
243#endif /* __DARWIN_C_LEVEL < 200809L */
244
245#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */ 
246#define _XOPEN_CRYPT                    (1)
247#define _XOPEN_ENH_I18N                 (1)             /* XXX required */
248#define _XOPEN_LEGACY                   (-1)    /* no ftime gcvt, wcswcs */
249#define _XOPEN_REALTIME                 (-1)    /* no q'ed signals, mq_* */
250#define _XOPEN_REALTIME_THREADS         (-1)    /* no posix_spawn, et. al. */
251#define _XOPEN_SHM                      (1)
252#define _XOPEN_STREAMS                  (-1)   /* Issue 6 */
253#define _XOPEN_UNIX                     (1)
254#endif /* XSI */
255
256/* configurable system variables */
257#define _SC_ARG_MAX                      1
258#define _SC_CHILD_MAX                    2
259#define _SC_CLK_TCK                      3
260#define _SC_NGROUPS_MAX                  4
261#define _SC_OPEN_MAX                     5
262#define _SC_JOB_CONTROL                  6
263#define _SC_SAVED_IDS                    7
264#define _SC_VERSION                      8
265#define _SC_BC_BASE_MAX                  9
266#define _SC_BC_DIM_MAX                  10
267#define _SC_BC_SCALE_MAX                11
268#define _SC_BC_STRING_MAX               12
269#define _SC_COLL_WEIGHTS_MAX            13
270#define _SC_EXPR_NEST_MAX               14
271#define _SC_LINE_MAX                    15
272#define _SC_RE_DUP_MAX                  16
273#define _SC_2_VERSION                   17
274#define _SC_2_C_BIND                    18
275#define _SC_2_C_DEV                     19
276#define _SC_2_CHAR_TERM                 20
277#define _SC_2_FORT_DEV                  21
278#define _SC_2_FORT_RUN                  22
279#define _SC_2_LOCALEDEF                 23
280#define _SC_2_SW_DEV                    24
281#define _SC_2_UPE                       25
282#define _SC_STREAM_MAX                  26
283#define _SC_TZNAME_MAX                  27
284
285#if __DARWIN_C_LEVEL >= 199309L
286#define _SC_ASYNCHRONOUS_IO             28
287#define _SC_PAGESIZE                    29
288#define _SC_MEMLOCK                     30
289#define _SC_MEMLOCK_RANGE               31
290#define _SC_MEMORY_PROTECTION           32
291#define _SC_MESSAGE_PASSING             33
292#define _SC_PRIORITIZED_IO              34
293#define _SC_PRIORITY_SCHEDULING         35
294#define _SC_REALTIME_SIGNALS            36
295#define _SC_SEMAPHORES                  37
296#define _SC_FSYNC                       38
297#define _SC_SHARED_MEMORY_OBJECTS       39
298#define _SC_SYNCHRONIZED_IO             40
299#define _SC_TIMERS                      41
300#define _SC_AIO_LISTIO_MAX              42
301#define _SC_AIO_MAX                     43
302#define _SC_AIO_PRIO_DELTA_MAX          44
303#define _SC_DELAYTIMER_MAX              45
304#define _SC_MQ_OPEN_MAX                 46
305#define _SC_MAPPED_FILES                47      /* swap _SC_PAGESIZE vs. BSD */
306#define _SC_RTSIG_MAX                   48
307#define _SC_SEM_NSEMS_MAX               49
308#define _SC_SEM_VALUE_MAX               50
309#define _SC_SIGQUEUE_MAX                51
310#define _SC_TIMER_MAX                   52
311#endif /* __DARWIN_C_LEVEL >= 199309L */
312
313#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
314#define _SC_NPROCESSORS_CONF            57
315#define _SC_NPROCESSORS_ONLN            58
316#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
317
318#if __DARWIN_C_LEVEL >= 200112L
319#define _SC_2_PBS                       59
320#define _SC_2_PBS_ACCOUNTING            60
321#define _SC_2_PBS_CHECKPOINT            61
322#define _SC_2_PBS_LOCATE                62
323#define _SC_2_PBS_MESSAGE               63
324#define _SC_2_PBS_TRACK                 64
325#define _SC_ADVISORY_INFO               65
326#define _SC_BARRIERS                    66
327#define _SC_CLOCK_SELECTION             67
328#define _SC_CPUTIME                     68
329#define _SC_FILE_LOCKING                69
330#define _SC_GETGR_R_SIZE_MAX            70
331#define _SC_GETPW_R_SIZE_MAX            71
332#define _SC_HOST_NAME_MAX               72
333#define _SC_LOGIN_NAME_MAX              73
334#define _SC_MONOTONIC_CLOCK             74
335#define _SC_MQ_PRIO_MAX                 75
336#define _SC_READER_WRITER_LOCKS         76
337#define _SC_REGEXP                      77
338#define _SC_SHELL                       78
339#define _SC_SPAWN                       79
340#define _SC_SPIN_LOCKS                  80
341#define _SC_SPORADIC_SERVER             81
342#define _SC_THREAD_ATTR_STACKADDR       82
343#define _SC_THREAD_ATTR_STACKSIZE       83
344#define _SC_THREAD_CPUTIME              84
345#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
346#define _SC_THREAD_KEYS_MAX             86
347#define _SC_THREAD_PRIO_INHERIT         87
348#define _SC_THREAD_PRIO_PROTECT         88
349#define _SC_THREAD_PRIORITY_SCHEDULING  89
350#define _SC_THREAD_PROCESS_SHARED       90
351#define _SC_THREAD_SAFE_FUNCTIONS       91
352#define _SC_THREAD_SPORADIC_SERVER      92
353#define _SC_THREAD_STACK_MIN            93
354#define _SC_THREAD_THREADS_MAX          94
355#define _SC_TIMEOUTS                    95
356#define _SC_THREADS                     96
357#define _SC_TRACE                       97
358#define _SC_TRACE_EVENT_FILTER          98
359#define _SC_TRACE_INHERIT               99
360#define _SC_TRACE_LOG                   100
361#define _SC_TTY_NAME_MAX                101
362#define _SC_TYPED_MEMORY_OBJECTS        102
363#define _SC_V6_ILP32_OFF32              103
364#define _SC_V6_ILP32_OFFBIG             104
365#define _SC_V6_LP64_OFF64               105
366#define _SC_V6_LPBIG_OFFBIG             106
367#define _SC_IPV6                        118
368#define _SC_RAW_SOCKETS                 119
369#define _SC_SYMLOOP_MAX                 120
370#endif /* __DARWIN_C_LEVEL >= 200112L */
371
372#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
373#define _SC_ATEXIT_MAX                  107
374#define _SC_IOV_MAX                     56
375#define _SC_PAGE_SIZE                   _SC_PAGESIZE
376#define _SC_XOPEN_CRYPT                 108
377#define _SC_XOPEN_ENH_I18N              109
378#define _SC_XOPEN_LEGACY                110      /* Issue 6 */
379#define _SC_XOPEN_REALTIME              111      /* Issue 6 */
380#define _SC_XOPEN_REALTIME_THREADS      112  /* Issue 6 */
381#define _SC_XOPEN_SHM                   113
382#define _SC_XOPEN_STREAMS               114      /* Issue 6 */
383#define _SC_XOPEN_UNIX                  115
384#define _SC_XOPEN_VERSION               116
385#define _SC_XOPEN_XCU_VERSION           121
386#endif /* XSI */
387
388#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
389/* Removed in Issue 7 */
390#define _SC_XBS5_ILP32_OFF32            122
391#define _SC_XBS5_ILP32_OFFBIG           123
392#define _SC_XBS5_LP64_OFF64             124
393#define _SC_XBS5_LPBIG_OFFBIG           125
394#endif /* __DARWIN_C_LEVEL <= 200809L */
395
396#if __DARWIN_C_LEVEL >= 200112L
397#define _SC_SS_REPL_MAX                 126
398#define _SC_TRACE_EVENT_NAME_MAX        127
399#define _SC_TRACE_NAME_MAX              128
400#define _SC_TRACE_SYS_MAX               129
401#define _SC_TRACE_USER_EVENT_MAX        130
402#endif
403
404#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
405/* Removed in Issue 6 */
406#define _SC_PASS_MAX                    131
407#endif
408
409#if __DARWIN_C_LEVEL >= 199209L
410#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
411#define _CS_PATH                                1
412#endif
413#endif
414
415#if __DARWIN_C_LEVEL >= 200112
416#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS         2
417#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS        3
418#define _CS_POSIX_V6_ILP32_OFF32_LIBS           4
419#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS        5
420#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS       6
421#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS          7
422#define _CS_POSIX_V6_LP64_OFF64_CFLAGS          8
423#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS         9
424#define _CS_POSIX_V6_LP64_OFF64_LIBS            10
425#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS        11
426#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS       12
427#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS          13
428#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS      14
429#endif
430
431#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
432/* Removed in Issue 7 */
433#define _CS_XBS5_ILP32_OFF32_CFLAGS             20
434#define _CS_XBS5_ILP32_OFF32_LDFLAGS            21
435#define _CS_XBS5_ILP32_OFF32_LIBS               22
436#define _CS_XBS5_ILP32_OFF32_LINTFLAGS          23
437#define _CS_XBS5_ILP32_OFFBIG_CFLAGS            24
438#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS           25
439#define _CS_XBS5_ILP32_OFFBIG_LIBS              26
440#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS         27
441#define _CS_XBS5_LP64_OFF64_CFLAGS              28
442#define _CS_XBS5_LP64_OFF64_LDFLAGS             29
443#define _CS_XBS5_LP64_OFF64_LIBS                30
444#define _CS_XBS5_LP64_OFF64_LINTFLAGS           31
445#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS            32
446#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS           33
447#define _CS_XBS5_LPBIG_OFFBIG_LIBS              34
448#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS         35
449#endif
450
451#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
452#define _CS_DARWIN_USER_DIR                     65536
453#define _CS_DARWIN_USER_TEMP_DIR                65537
454#define _CS_DARWIN_USER_CACHE_DIR               65538
455#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
456
457
458#ifdef _DARWIN_UNLIMITED_GETGROUPS
459#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
460#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
461#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
462#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
463#endif
464#endif
465
466/* POSIX.1-1990 */
467
468__BEGIN_DECLS
469void     _exit(int) __dead2;
470int      access(const char *, int);
471unsigned int
472         alarm(unsigned int);
473int      chdir(const char *);
474int      chown(const char *, uid_t, gid_t);
475
476int      close(int) __DARWIN_ALIAS_C(close);
477
478int      dup(int);
479int      dup2(int, int);
480int      execl(const char *, const char *, ...);
481int      execle(const char *, const char *, ...);
482int      execlp(const char *, const char *, ...);
483int      execv(const char *, char * const *);
484int      execve(const char *, char * const *, char * const *);
485int      execvp(const char *, char * const *);
486pid_t    fork(void);
487long     fpathconf(int, int);
488char    *getcwd(char *, size_t);
489gid_t    getegid(void);
490uid_t    geteuid(void);
491gid_t    getgid(void);
492#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
493int      getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
494#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
495int      getgroups(int, gid_t []);
496#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
497char    *getlogin(void);
498pid_t    getpgrp(void);
499pid_t    getpid(void);
500pid_t    getppid(void);
501uid_t    getuid(void);
502int      isatty(int);
503int      link(const char *, const char *);
504off_t    lseek(int, off_t, int);
505long     pathconf(const char *, int);
506
507int      pause(void) __DARWIN_ALIAS_C(pause);
508
509int      pipe(int [2]);
510
511ssize_t  read(int, void *, size_t) __DARWIN_ALIAS_C(read);
512
513int      rmdir(const char *);
514int      setgid(gid_t);
515int      setpgid(pid_t, pid_t);
516pid_t    setsid(void);
517int      setuid(uid_t);
518
519unsigned int
520         sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
521
522long     sysconf(int);
523pid_t    tcgetpgrp(int);
524int      tcsetpgrp(int, pid_t);
525char    *ttyname(int);
526
527#if __DARWIN_UNIX03
528int      ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
529#else /* !__DARWIN_UNIX03 */
530char    *ttyname_r(int, char *, size_t);
531#endif /* __DARWIN_UNIX03 */
532
533int      unlink(const char *);
534
535ssize_t  write(int, const void *, size_t) __DARWIN_ALIAS_C(write);
536__END_DECLS
537
538
539
540/* Additional functionality provided by:
541 * POSIX.2-1992 C Language Binding Option
542 */
543
544#if __DARWIN_C_LEVEL >= 199209L
545__BEGIN_DECLS
546size_t   confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
547
548int      getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
549
550extern char *optarg;                    /* getopt(3) external variables */
551extern int optind, opterr, optopt;
552__END_DECLS
553#endif /* __DARWIN_C_LEVEL >= 199209L */
554
555
556
557/* Additional functionality provided by:
558 * POSIX.1c-1995,
559 * POSIX.1i-1995,
560 * and the omnibus ISO/IEC 9945-1: 1996
561 */
562
563#if __DARWIN_C_LEVEL >= 199506L
564                               /* These F_* are really XSI or Issue 6 */
565#define F_ULOCK         0      /* unlock locked section */
566#define F_LOCK          1      /* lock a section for exclusive use */
567#define F_TLOCK         2      /* test and lock a section for exclusive use */
568#define F_TEST          3      /* test a section for locks by other procs */
569
570 __BEGIN_DECLS
571
572/* Begin XSI */
573/* Removed in Issue 6 */
574#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
575void    *brk(const void *);
576int      chroot(const char *) __POSIX_C_DEPRECATED(199506L);
577#endif
578
579char    *crypt(const char *, const char *);
580#ifndef __CTERMID_DEFINED
581/* Multiply defined in stdio.h and unistd.h by SUS */
582#define __CTERMID_DEFINED 1
583char    *ctermid(char *);
584#endif
585#if __DARWIN_UNIX03
586void     encrypt(char *, int) __DARWIN_ALIAS(encrypt);
587#else /* !__DARWIN_UNIX03 */
588int      encrypt(char *, int);
589#endif /* __DARWIN_UNIX03 */
590int      fchdir(int);
591long     gethostid(void);
592pid_t    getpgid(pid_t);
593pid_t    getsid(pid_t);
594
595/* Removed in Issue 6 */
596#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
597int      getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
598int      getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
599char    *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
600#endif
601
602/* Removed in Issue 7 */
603#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
604char    *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
605#endif
606
607int      lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
608
609int      lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
610
611int      nice(int) __DARWIN_ALIAS(nice);
612
613ssize_t  pread(int, void *, size_t, off_t) __DARWIN_ALIAS_C(pread);
614
615ssize_t  pwrite(int, const void *, size_t, off_t) __DARWIN_ALIAS_C(pwrite);
616
617/* Removed in Issue 6 */
618#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
619/* Note that Issue 5 changed the argument as intprt_t,
620 * but we keep it as int for binary compatability. */
621void    *sbrk(int);
622#endif
623
624#if __DARWIN_UNIX03
625pid_t    setpgrp(void) __DARWIN_ALIAS(setpgrp);
626#else /* !__DARWIN_UNIX03 */
627int      setpgrp(pid_t pid, pid_t pgrp);        /* obsoleted by setpgid() */
628#endif /* __DARWIN_UNIX03 */
629
630int      setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
631
632int      setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
633
634void     swab(const void * __restrict, void * __restrict, ssize_t);
635void     sync(void);
636int      truncate(const char *, off_t);
637useconds_t       ualarm(useconds_t, useconds_t);
638int      usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
639pid_t    vfork(void);
640/* End XSI */
641
642int      fsync(int) __DARWIN_ALIAS_C(fsync);
643
644int      ftruncate(int, off_t);
645int      getlogin_r(char *, size_t);
646__END_DECLS
647#endif /* __DARWIN_C_LEVEL >= 199506L */
648
649
650
651/* Additional functionality provided by:
652 * POSIX.1-2001
653 * ISO C99
654 */
655
656#if __DARWIN_C_LEVEL >= 200112L
657__BEGIN_DECLS
658int      fchown(int, uid_t, gid_t);
659int      gethostname(char *, size_t);
660ssize_t  readlink(const char * __restrict, char * __restrict, size_t);
661int      setegid(gid_t);
662int      seteuid(uid_t);
663int      symlink(const char *, const char *);
664__END_DECLS
665#endif /* __DARWIN_C_LEVEL >= 200112L */
666
667
668
669/* Darwin extensions */
670
671#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
672#include <sys/select.h>
673
674#ifndef _DEV_T
675#define _DEV_T
676typedef __darwin_dev_t          dev_t;
677#endif
678
679#ifndef _MODE_T
680#define _MODE_T
681typedef __darwin_mode_t         mode_t;
682#endif
683
684#ifndef _UUID_T
685#define _UUID_T
686typedef __darwin_uuid_t         uuid_t;
687#endif /* _UUID_T */
688
689__BEGIN_DECLS
690void     _Exit(int) __dead2;
691int      accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
692int      acct(const char *);
693int      add_profil(char *, size_t, unsigned long, unsigned int);
694void     endusershell(void);
695int      execvP(const char *, const char *, char * const *);
696char    *fflagstostr(unsigned long);
697int      getdomainname(char *, int);
698int      getgrouplist(const char *, int, int *, int *);
699int      gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
700mode_t   getmode(const void *, mode_t);
701int      getpeereid(int, uid_t *, gid_t *);
702int      getsgroups_np(int *, uuid_t);
703char    *getusershell(void);
704int      getwgroups_np(int *, uuid_t);
705int      initgroups(const char *, int);
706int      iruserok(unsigned long, int, const char *, const char *);
707int      iruserok_sa(const void *, int, int, const char *, const char *);
708int      issetugid(void);
709char    *mkdtemp(char *);
710int      mknod(const char *, mode_t, dev_t);
711int      mkpath_np(char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
712int      mkstemp(char *);
713int      mkstemps(char *, int);
714char    *mktemp(char *);
715int      nfssvc(int, void *);
716int      profil(char *, size_t, unsigned long, unsigned int);
717int      pthread_setugid_np(uid_t, gid_t);
718int      pthread_getugid_np( uid_t *, gid_t *);
719int      rcmd(char **, int, const char *, const char *, const char *, int *);
720int      rcmd_af(char **, int, const char *, const char *, const char *, int *,
721                int);
722int      reboot(int);
723int      revoke(const char *);
724int      rresvport(int *);
725int      rresvport_af(int *, int);
726int      ruserok(const char *, int, const char *, const char *);
727int      setdomainname(const char *, int);
728int      setgroups(int, const gid_t *);
729void     sethostid(long);
730int      sethostname(const char *, int);
731#if __DARWIN_UNIX03
732void     setkey(const char *) __DARWIN_ALIAS(setkey);
733#else /* !__DARWIN_UNIX03 */
734int      setkey(const char *);
735#endif /* __DARWIN_UNIX03 */
736int      setlogin(const char *);
737void    *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
738int      setrgid(gid_t);
739int      setruid(uid_t);
740int      setsgroups_np(int, const uuid_t);
741void     setusershell(void);
742int      setwgroups_np(int, const uuid_t);
743int      strtofflags(char **, unsigned long *, unsigned long *);
744int      swapon(const char *);
745int      syscall(int, ...);
746int      ttyslot(void);
747int      undelete(const char *);
748int      unwhiteout(const char *);
749void    *valloc(size_t);                       
750
751extern char *suboptarg;                 /* getsubopt(3) external variable */
752int      getsubopt(char **, char * const *, char **);
753
754/*  HFS & HFS Plus semantics system calls go here */
755#ifdef __LP64__
756int    fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
757int    fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
758int    getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
759int    setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
760int exchangedata(const char*,const char*,unsigned int);
761int    getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int);
762
763#else /* __LP64__ */
764int     fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
765int     fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
766int     getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
767int     setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
768int exchangedata(const char*,const char*,unsigned long);
769int     getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long);
770
771#endif /* __LP64__ */
772
773struct fssearchblock;
774struct searchstate;
775
776int      searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *);
777int      fsctl(const char *,unsigned long,void*,unsigned int);
778int      ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
779
780#define SYNC_VOLUME_FULLSYNC    0x01    /* Flush data and metadata to platter, not just to disk cache */
781#define SYNC_VOLUME_WAIT        0x02    /* Wait for sync to complete */
782
783int     fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
784int     sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
785
786extern int optreset;
787
788__END_DECLS
789#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
790
791#endif /* _UNISTD_H_ */