2 * Copyright (c) 2000, 2002-2006, 2008-2010 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
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.
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
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.
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
56 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
58 * Copyright (c) 1998 Apple Compter, Inc.
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
72 #include <sys/unistd.h>
73 #include <Availability.h>
77 typedef __darwin_gid_t gid_t
;
82 typedef __darwin_intptr_t
intptr_t;
87 typedef __darwin_off_t off_t
;
92 typedef __darwin_pid_t pid_t
;
97 /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
99 typedef __darwin_size_t
size_t;
104 typedef __darwin_ssize_t ssize_t
;
109 typedef __darwin_uid_t uid_t
; /* user id */
114 typedef __darwin_useconds_t useconds_t
;
118 #define NULL __DARWIN_NULL
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 */
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 */
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 */
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 */
201 #define __ILP32_OFF32 (-1)
202 #define __ILP32_OFFBIG (-1)
203 #define __LP64_OFF64 (-1)
204 #define __LPBIG_OFFBIG (-1)
208 #define __LP64_OFF64 (1)
209 #undef __LPBIG_OFFBIG
210 #define __LPBIG_OFFBIG (1)
212 #undef __ILP32_OFFBIG
213 #define __ILP32_OFFBIG (1)
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 */
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 */
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 */
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 */
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)
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
282 #define _SC_STREAM_MAX 26
283 #define _SC_TZNAME_MAX 27
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
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 */
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 */
318 #if __DARWIN_C_LEVEL >= 200112L
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
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
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
368 #define _SC_RAW_SOCKETS 119
369 #define _SC_SYMLOOP_MAX 120
370 #endif /* __DARWIN_C_LEVEL >= 200112L */
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
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 */
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
404 #if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
405 /* Removed in Issue 6 */
406 #define _SC_PASS_MAX 131
409 #if __DARWIN_C_LEVEL >= 199209L
410 #ifndef _CS_PATH /* Defined in <sys/unistd.h> */
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
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
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 */
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."
469 void _exit(int) __dead2
;
470 int access(const char *, int);
473 int chdir(const char *);
474 int chown(const char *, uid_t
, gid_t
);
477 #ifndef LIBC_ALIAS_CLOSE
479 int close(int) __DARWIN_ALIAS_C(close
);
481 #else /* LIBC_ALIAS_CLOSE */
482 int close(int) LIBC_ALIAS_C(close
);
483 #endif /* !LIBC_ALIAS_CLOSE */
488 int execl(const char *, const char *, ...);
489 int execle(const char *, const char *, ...);
490 int execlp(const char *, const char *, ...);
491 int execv(const char *, char * const *);
492 int execve(const char *, char * const *, char * const *);
493 int execvp(const char *, char * const *);
495 long fpathconf(int, int);
496 char *getcwd(char *, size_t);
500 #if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
501 int getgroups(int, gid_t
[]) __DARWIN_ALIAS_STARTING(__MAC_10_6
, __IPHONE_3_2
, __DARWIN_EXTSN(getgroups
));
502 #else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
503 int getgroups(int, gid_t
[]);
504 #endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
505 char *getlogin(void);
511 int link(const char *, const char *);
512 off_t
lseek(int, off_t
, int);
513 long pathconf(const char *, int);
516 #ifndef LIBC_ALIAS_PAUSE
518 int pause(void) __DARWIN_ALIAS_C(pause
);
520 #else /* LIBC_ALIAS_PAUSE */
521 int pause(void) LIBC_ALIAS_C(pause
);
522 #endif /* !LIBC_ALIAS_PAUSE */
528 #ifndef LIBC_ALIAS_READ
530 ssize_t
read(int, void *, size_t) __DARWIN_ALIAS_C(read
);
532 #else /* LIBC_ALIAS_READ */
533 ssize_t
read(int, void *, size_t) LIBC_ALIAS_C(read
);
534 #endif /* !LIBC_ALIAS_READ */
537 int rmdir(const char *);
539 int setpgid(pid_t
, pid_t
);
544 #ifndef LIBC_ALIAS_SLEEP
547 sleep(unsigned int) __DARWIN_ALIAS_C(sleep
);
549 #else /* LIBC_ALIAS_SLEEP */
551 sleep(unsigned int) LIBC_ALIAS_C(sleep
);
552 #endif /* !LIBC_ALIAS_SLEEP */
556 pid_t
tcgetpgrp(int);
557 int tcsetpgrp(int, pid_t
);
562 #ifndef LIBC_ALIAS_TTYNAME_R
564 int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r
);
566 #else /* LIBC_ALIAS_TTYNAME_R */
567 int ttyname_r(int, char *, size_t) LIBC_ALIAS(ttyname_r
);
568 #endif /* !LIBC_ALIAS_TTYNAME_R */
570 #else /* !__DARWIN_UNIX03 */
571 char *ttyname_r(int, char *, size_t);
572 #endif /* __DARWIN_UNIX03 */
574 int unlink(const char *);
577 #ifndef LIBC_ALIAS_WRITE
579 ssize_t
write(int, const void *, size_t) __DARWIN_ALIAS_C(write
);
581 #else /* LIBC_ALIAS_WRITE */
582 ssize_t
write(int, const void *, size_t) LIBC_ALIAS_C(write
);
583 #endif /* !LIBC_ALIAS_WRITE */
589 /* Additional functionality provided by:
590 * POSIX.2-1992 C Language Binding Option
593 #if __DARWIN_C_LEVEL >= 199209L
596 #ifndef LIBC_ALIAS_CONFSTR
598 size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr
);
600 #else /* LIBC_ALIAS_CONFSTR */
601 size_t confstr(int, char *, size_t) LIBC_ALIAS(confstr
);
602 #endif /* !LIBC_ALIAS_CONFSTR */
606 #ifndef LIBC_ALIAS_GETOPT
608 int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt
);
610 #else /* LIBC_ALIAS_GETOPT */
611 int getopt(int, char * const [], const char *) LIBC_ALIAS(getopt
);
612 #endif /* !LIBC_ALIAS_GETOPT */
615 extern char *optarg
; /* getopt(3) external variables */
616 extern int optind
, opterr
, optopt
;
618 #endif /* __DARWIN_C_LEVEL >= 199209L */
622 /* Additional functionality provided by:
625 * and the omnibus ISO/IEC 9945-1: 1996
628 #if __DARWIN_C_LEVEL >= 199506L
629 /* These F_* are really XSI or Issue 6 */
630 #define F_ULOCK 0 /* unlock locked section */
631 #define F_LOCK 1 /* lock a section for exclusive use */
632 #define F_TLOCK 2 /* test and lock a section for exclusive use */
633 #define F_TEST 3 /* test a section for locks by other procs */
638 /* Removed in Issue 6 */
639 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
640 void *brk(const void *);
641 int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
644 char *crypt(const char *, const char *);
645 #ifndef __CTERMID_DEFINED
646 /* Multiply defined in stdio.h and unistd.h by SUS */
647 #define __CTERMID_DEFINED 1
648 char *ctermid(char *);
652 #ifndef LIBC_ALIAS_ENCRYPT
654 void encrypt(char *, int) __DARWIN_ALIAS(encrypt
);
656 #else /* LIBC_ALIAS_ENCRYPT */
657 void encrypt(char *, int) LIBC_ALIAS(encrypt
);
658 #endif /* !LIBC_ALIAS_ENCRYPT */
660 #else /* !__DARWIN_UNIX03 */
661 int encrypt(char *, int);
662 #endif /* __DARWIN_UNIX03 */
664 long gethostid(void);
665 pid_t
getpgid(pid_t
);
668 /* Removed in Issue 6 */
669 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
670 int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
671 int getpagesize(void) __pure2
__POSIX_C_DEPRECATED(199506L);
672 char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
675 /* Removed in Issue 7 */
676 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
677 char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
681 #ifndef LIBC_ALIAS_LCHOWN
683 int lchown(const char *, uid_t
, gid_t
) __DARWIN_ALIAS(lchown
);
685 #else /* LIBC_ALIAS_LCHOWN */
686 int lchown(const char *, uid_t
, gid_t
) LIBC_ALIAS(lchown
);
687 #endif /* !LIBC_ALIAS_LCHOWN */
691 #ifndef LIBC_ALIAS_LOCKF
693 int lockf(int, int, off_t
) __DARWIN_ALIAS_C(lockf
);
695 #else /* LIBC_ALIAS_LOCKF */
696 int lockf(int, int, off_t
) LIBC_ALIAS_C(lockf
);
697 #endif /* !LIBC_ALIAS_LOCKF */
701 #ifndef LIBC_ALIAS_NICE
703 int nice(int) __DARWIN_ALIAS(nice
);
705 #else /* LIBC_ALIAS_NICE */
706 int nice(int) LIBC_ALIAS(nice
);
707 #endif /* !LIBC_ALIAS_NICE */
711 #ifndef LIBC_ALIAS_PREAD
713 ssize_t
pread(int, void *, size_t, off_t
) __DARWIN_ALIAS_C(pread
);
715 #else /* LIBC_ALIAS_PREAD */
716 ssize_t
pread(int, void *, size_t, off_t
) LIBC_ALIAS_C(pread
);
717 #endif /* !LIBC_ALIAS_PREAD */
721 #ifndef LIBC_ALIAS_PWRITE
723 ssize_t
pwrite(int, const void *, size_t, off_t
) __DARWIN_ALIAS_C(pwrite
);
725 #else /* LIBC_ALIAS_PWRITE */
726 ssize_t
pwrite(int, const void *, size_t, off_t
) LIBC_ALIAS_C(pwrite
);
727 #endif /* !LIBC_ALIAS_PWRITE */
730 /* Removed in Issue 6 */
731 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
732 /* Note that Issue 5 changed the argument as intprt_t,
733 * but we keep it as int for binary compatability. */
739 #ifndef LIBC_ALIAS_SETPGRP
741 pid_t
setpgrp(void) __DARWIN_ALIAS(setpgrp
);
743 #else /* LIBC_ALIAS_SETPGRP */
744 pid_t
setpgrp(void) LIBC_ALIAS(setpgrp
);
745 #endif /* !LIBC_ALIAS_SETPGRP */
747 #else /* !__DARWIN_UNIX03 */
748 int setpgrp(pid_t pid
, pid_t pgrp
); /* obsoleted by setpgid() */
749 #endif /* __DARWIN_UNIX03 */
752 #ifndef LIBC_ALIAS_SETREGID
754 int setregid(gid_t
, gid_t
) __DARWIN_ALIAS(setregid
);
756 #else /* LIBC_ALIAS_SETREGID */
757 int setregid(gid_t
, gid_t
) LIBC_ALIAS(setregid
);
758 #endif /* !LIBC_ALIAS_SETREGID */
762 #ifndef LIBC_ALIAS_SETREUID
764 int setreuid(uid_t
, uid_t
) __DARWIN_ALIAS(setreuid
);
766 #else /* LIBC_ALIAS_SETREUID */
767 int setreuid(uid_t
, uid_t
) LIBC_ALIAS(setreuid
);
768 #endif /* !LIBC_ALIAS_SETREUID */
771 void swab(const void * __restrict
, void * __restrict
, ssize_t
);
773 int truncate(const char *, off_t
);
774 useconds_t
ualarm(useconds_t
, useconds_t
);
776 #ifndef LIBC_ALIAS_USLEEP
778 int usleep(useconds_t
) __DARWIN_ALIAS_C(usleep
);
780 #else /* LIBC_ALIAS_USLEEP */
781 int usleep(useconds_t
) LIBC_ALIAS_C(usleep
);
782 #endif /* !LIBC_ALIAS_USLEEP */
788 #ifndef LIBC_ALIAS_FSYNC
790 int fsync(int) __DARWIN_ALIAS_C(fsync
);
792 #else /* LIBC_ALIAS_FSYNC */
793 int fsync(int) LIBC_ALIAS_C(fsync
);
794 #endif /* !LIBC_ALIAS_FSYNC */
797 int ftruncate(int, off_t
);
798 int getlogin_r(char *, size_t);
800 #endif /* __DARWIN_C_LEVEL >= 199506L */
804 /* Additional functionality provided by:
809 #if __DARWIN_C_LEVEL >= 200112L
811 int fchown(int, uid_t
, gid_t
);
812 int gethostname(char *, size_t);
813 ssize_t
readlink(const char * __restrict
, char * __restrict
, size_t);
816 int symlink(const char *, const char *);
818 #endif /* __DARWIN_C_LEVEL >= 200112L */
822 /* Darwin extensions */
824 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
825 #include <sys/select.h>
829 typedef __darwin_dev_t dev_t
;
834 typedef __darwin_mode_t mode_t
;
839 typedef __darwin_uuid_t uuid_t
;
843 void _Exit(int) __dead2
;
844 int accessx_np(const struct accessx_descriptor
*, size_t, int *, uid_t
);
845 int acct(const char *);
846 int add_profil(char *, size_t, unsigned long, unsigned int);
847 void endusershell(void);
848 int execvP(const char *, const char *, char * const *);
849 char *fflagstostr(unsigned long);
850 int getdomainname(char *, int);
851 int getgrouplist(const char *, int, int *, int *);
852 int gethostuuid(uuid_t
, const struct timespec
*) __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_2_0
);
853 mode_t
getmode(const void *, mode_t
);
854 int getpeereid(int, uid_t
*, gid_t
*);
855 int getsgroups_np(int *, uuid_t
);
856 char *getusershell(void);
857 int getwgroups_np(int *, uuid_t
);
858 int initgroups(const char *, int);
859 int iruserok(unsigned long, int, const char *, const char *);
860 int iruserok_sa(const void *, int, int, const char *, const char *);
862 char *mkdtemp(char *);
863 int mknod(const char *, mode_t
, dev_t
);
865 int mkstemps(char *, int);
866 char *mktemp(char *);
867 int nfssvc(int, void *);
868 int profil(char *, size_t, unsigned long, unsigned int);
869 int pthread_setugid_np(uid_t
, gid_t
);
870 int pthread_getugid_np( uid_t
*, gid_t
*);
871 int rcmd(char **, int, const char *, const char *, const char *, int *);
872 int rcmd_af(char **, int, const char *, const char *, const char *, int *,
875 int revoke(const char *);
876 int rresvport(int *);
877 int rresvport_af(int *, int);
878 int ruserok(const char *, int, const char *, const char *);
879 int setdomainname(const char *, int);
880 int setgroups(int, const gid_t
*);
881 void sethostid(long);
882 int sethostname(const char *, int);
885 #ifndef LIBC_ALIAS_SETKEY
887 void setkey(const char *) __DARWIN_ALIAS(setkey
);
889 #else /* LIBC_ALIAS_SETKEY */
890 void setkey(const char *) LIBC_ALIAS(setkey
);
891 #endif /* !LIBC_ALIAS_SETKEY */
893 #else /* !__DARWIN_UNIX03 */
894 int setkey(const char *);
895 #endif /* __DARWIN_UNIX03 */
896 int setlogin(const char *);
898 #ifndef LIBC_ALIAS_SETMODE
900 void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6
, __IPHONE_2_0
, __DARWIN_ALIAS(setmode
));
902 #else /* LIBC_ALIAS_SETMODE */
903 void *setmode(const char *) LIBC_ALIAS(setmode
);
904 #endif /* !LIBC_ALIAS_SETMODE */
908 int setsgroups_np(int, const uuid_t
);
909 void setusershell(void);
910 int setwgroups_np(int, const uuid_t
);
911 int strtofflags(char **, unsigned long *, unsigned long *);
912 int swapon(const char *);
913 int syscall(int, ...);
915 int undelete(const char *);
916 int unwhiteout(const char *);
917 void *valloc(size_t);
919 extern char *suboptarg
; /* getsubopt(3) external variable */
920 int getsubopt(char **, char * const *, char **);
922 /* HFS & HFS Plus semantics system calls go here */
924 int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
925 int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
927 #ifndef LIBC_ALIAS_GETATTRLIST
929 int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist
);
931 #else /* LIBC_ALIAS_GETATTRLIST */
932 int getattrlist(const char*,void*,void*,size_t,unsigned int) LIBC_ALIAS(getattrlist
);
933 #endif /* !LIBC_ALIAS_GETATTRLIST */
936 #ifndef LIBC_ALIAS_SETATTRLIST
938 int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist
);
940 #else /* LIBC_ALIAS_SETATTRLIST */
941 int setattrlist(const char*,void*,void*,size_t,unsigned int) LIBC_ALIAS(setattrlist
);
942 #endif /* !LIBC_ALIAS_SETATTRLIST */
944 int exchangedata(const char*,const char*,unsigned int);
945 int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int);
948 int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
949 int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
951 #ifndef LIBC_ALIAS_GETATTRLIST
953 int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist
);
955 #else /* LIBC_ALIAS_GETATTRLIST */
956 int getattrlist(const char*,void*,void*,size_t,unsigned long) LIBC_ALIAS(getattrlist
);
957 #endif /* !LIBC_ALIAS_GETATTRLIST */
960 #ifndef LIBC_ALIAS_SETATTRLIST
962 int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist
);
964 #else /* LIBC_ALIAS_SETATTRLIST */
965 int setattrlist(const char*,void*,void*,size_t,unsigned long) LIBC_ALIAS(setattrlist
);
966 #endif /* !LIBC_ALIAS_SETATTRLIST */
968 int exchangedata(const char*,const char*,unsigned long);
969 int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long);
971 #endif /* __LP64__ */
973 struct fssearchblock
;
976 int searchfs(const char *, struct fssearchblock
*, unsigned long *, unsigned int, unsigned int, struct searchstate
*);
977 int fsctl(const char *,unsigned long,void*,unsigned int);
978 int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
983 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
985 #endif /* _UNISTD_H_ */