2 * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 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>
74 #include <sys/_types/_gid_t.h>
75 #include <sys/_types/_intptr_t.h>
76 #include <sys/_types/_off_t.h>
77 #include <sys/_types/_pid_t.h>
78 /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
80 #include <sys/_types/_size_t.h>
81 #include <sys/_types/_ssize_t.h>
82 #include <sys/_types/_uid_t.h>
83 #include <sys/_types/_useconds_t.h>
84 #include <sys/_types/_null.h>
86 #define STDIN_FILENO 0 /* standard input file descriptor */
87 #define STDOUT_FILENO 1 /* standard output file descriptor */
88 #define STDERR_FILENO 2 /* standard error file descriptor */
91 /* Version test macros */
92 /* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
93 #define _XOPEN_VERSION 600 /* [XSI] */
94 #define _XOPEN_XCU_VERSION 4 /* Older standard */
97 /* Please keep this list in the same order as the applicable standard */
98 #define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
99 #define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
100 #define _POSIX_BARRIERS (-1) /* [BAR] */
101 #define _POSIX_CHOWN_RESTRICTED 200112L
102 #define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
103 #define _POSIX_CPUTIME (-1) /* [CPT] */
104 #define _POSIX_FSYNC 200112L /* [FSC] */
105 #define _POSIX_IPV6 200112L
106 #define _POSIX_JOB_CONTROL 200112L
107 #define _POSIX_MAPPED_FILES 200112L /* [MF] */
108 #define _POSIX_MEMLOCK (-1) /* [ML] */
109 #define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
110 #define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
111 #define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
112 #define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
113 #define _POSIX_NO_TRUNC 200112L
114 #define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
115 #define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
116 #define _POSIX_RAW_SOCKETS (-1) /* [RS] */
117 #define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
118 #define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
119 #define _POSIX_REGEXP 200112L
120 #define _POSIX_SAVED_IDS 200112L /* XXX required */
121 #define _POSIX_SEMAPHORES (-1) /* [SEM] */
122 #define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
123 #define _POSIX_SHELL 200112L
124 #define _POSIX_SPAWN (-1) /* [SPN] */
125 #define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
126 #define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
127 #define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
128 #define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
129 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
130 #define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
131 #define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
132 #define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
133 #define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
134 #define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
135 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
136 #define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
137 #define _POSIX_THREADS 200112L /* [THR] */
138 #define _POSIX_TIMEOUTS (-1) /* [TMO] */
139 #define _POSIX_TIMERS (-1) /* [TMR] */
140 #define _POSIX_TRACE (-1) /* [TRC] */
141 #define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
142 #define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
143 #define _POSIX_TRACE_LOG (-1) /* [TRL] */
144 #define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
145 #ifndef _POSIX_VDISABLE
146 #define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
147 #endif /* _POSIX_VDISABLE */
149 #if __DARWIN_C_LEVEL >= 199209L
150 #define _POSIX2_C_BIND 200112L
151 #define _POSIX2_C_DEV 200112L /* c99 command */
152 #define _POSIX2_CHAR_TERM 200112L
153 #define _POSIX2_FORT_DEV (-1) /* fort77 command */
154 #define _POSIX2_FORT_RUN 200112L
155 #define _POSIX2_LOCALEDEF 200112L /* localedef command */
156 #define _POSIX2_PBS (-1)
157 #define _POSIX2_PBS_ACCOUNTING (-1)
158 #define _POSIX2_PBS_CHECKPOINT (-1)
159 #define _POSIX2_PBS_LOCATE (-1)
160 #define _POSIX2_PBS_MESSAGE (-1)
161 #define _POSIX2_PBS_TRACK (-1)
162 #define _POSIX2_SW_DEV 200112L
163 #define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
164 #endif /* __DARWIN_C_LEVEL */
166 #define __ILP32_OFF32 (-1)
167 #define __ILP32_OFFBIG (1)
168 #define __LP64_OFF64 (1)
169 #define __LPBIG_OFFBIG (1)
171 #if __DARWIN_C_LEVEL >= 200112L
172 #define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
173 #define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
174 #define _POSIX_V6_LP64_OFF64 __LP64_OFF64
175 #define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
176 #endif /* __DARWIN_C_LEVEL >= 200112L */
178 #if __DARWIN_C_LEVEL >= 200809L
179 #define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
180 #define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
181 #define _POSIX_V7_LP64_OFF64 __LP64_OFF64
182 #define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
183 #endif /* __DARWIN_C_LEVEL >= 200809L */
185 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
186 #define _V6_ILP32_OFF32 __ILP32_OFF32
187 #define _V6_ILP32_OFFBIG __ILP32_OFFBIG
188 #define _V6_LP64_OFF64 __LP64_OFF64
189 #define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
190 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
192 #if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
193 /* Removed in Issue 7 */
194 #define _XBS5_ILP32_OFF32 __ILP32_OFF32
195 #define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
196 #define _XBS5_LP64_OFF64 __LP64_OFF64
197 #define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
198 #endif /* __DARWIN_C_LEVEL < 200809L */
200 #if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
201 #define _XOPEN_CRYPT (1)
202 #define _XOPEN_ENH_I18N (1) /* XXX required */
203 #define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
204 #define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
205 #define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
206 #define _XOPEN_SHM (1)
207 #define _XOPEN_STREAMS (-1) /* Issue 6 */
208 #define _XOPEN_UNIX (1)
211 /* configurable system variables */
212 #define _SC_ARG_MAX 1
213 #define _SC_CHILD_MAX 2
214 #define _SC_CLK_TCK 3
215 #define _SC_NGROUPS_MAX 4
216 #define _SC_OPEN_MAX 5
217 #define _SC_JOB_CONTROL 6
218 #define _SC_SAVED_IDS 7
219 #define _SC_VERSION 8
220 #define _SC_BC_BASE_MAX 9
221 #define _SC_BC_DIM_MAX 10
222 #define _SC_BC_SCALE_MAX 11
223 #define _SC_BC_STRING_MAX 12
224 #define _SC_COLL_WEIGHTS_MAX 13
225 #define _SC_EXPR_NEST_MAX 14
226 #define _SC_LINE_MAX 15
227 #define _SC_RE_DUP_MAX 16
228 #define _SC_2_VERSION 17
229 #define _SC_2_C_BIND 18
230 #define _SC_2_C_DEV 19
231 #define _SC_2_CHAR_TERM 20
232 #define _SC_2_FORT_DEV 21
233 #define _SC_2_FORT_RUN 22
234 #define _SC_2_LOCALEDEF 23
235 #define _SC_2_SW_DEV 24
237 #define _SC_STREAM_MAX 26
238 #define _SC_TZNAME_MAX 27
240 #if __DARWIN_C_LEVEL >= 199309L
241 #define _SC_ASYNCHRONOUS_IO 28
242 #define _SC_PAGESIZE 29
243 #define _SC_MEMLOCK 30
244 #define _SC_MEMLOCK_RANGE 31
245 #define _SC_MEMORY_PROTECTION 32
246 #define _SC_MESSAGE_PASSING 33
247 #define _SC_PRIORITIZED_IO 34
248 #define _SC_PRIORITY_SCHEDULING 35
249 #define _SC_REALTIME_SIGNALS 36
250 #define _SC_SEMAPHORES 37
252 #define _SC_SHARED_MEMORY_OBJECTS 39
253 #define _SC_SYNCHRONIZED_IO 40
254 #define _SC_TIMERS 41
255 #define _SC_AIO_LISTIO_MAX 42
256 #define _SC_AIO_MAX 43
257 #define _SC_AIO_PRIO_DELTA_MAX 44
258 #define _SC_DELAYTIMER_MAX 45
259 #define _SC_MQ_OPEN_MAX 46
260 #define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
261 #define _SC_RTSIG_MAX 48
262 #define _SC_SEM_NSEMS_MAX 49
263 #define _SC_SEM_VALUE_MAX 50
264 #define _SC_SIGQUEUE_MAX 51
265 #define _SC_TIMER_MAX 52
266 #endif /* __DARWIN_C_LEVEL >= 199309L */
268 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
269 #define _SC_NPROCESSORS_CONF 57
270 #define _SC_NPROCESSORS_ONLN 58
271 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
273 #if __DARWIN_C_LEVEL >= 200112L
275 #define _SC_2_PBS_ACCOUNTING 60
276 #define _SC_2_PBS_CHECKPOINT 61
277 #define _SC_2_PBS_LOCATE 62
278 #define _SC_2_PBS_MESSAGE 63
279 #define _SC_2_PBS_TRACK 64
280 #define _SC_ADVISORY_INFO 65
281 #define _SC_BARRIERS 66
282 #define _SC_CLOCK_SELECTION 67
283 #define _SC_CPUTIME 68
284 #define _SC_FILE_LOCKING 69
285 #define _SC_GETGR_R_SIZE_MAX 70
286 #define _SC_GETPW_R_SIZE_MAX 71
287 #define _SC_HOST_NAME_MAX 72
288 #define _SC_LOGIN_NAME_MAX 73
289 #define _SC_MONOTONIC_CLOCK 74
290 #define _SC_MQ_PRIO_MAX 75
291 #define _SC_READER_WRITER_LOCKS 76
292 #define _SC_REGEXP 77
295 #define _SC_SPIN_LOCKS 80
296 #define _SC_SPORADIC_SERVER 81
297 #define _SC_THREAD_ATTR_STACKADDR 82
298 #define _SC_THREAD_ATTR_STACKSIZE 83
299 #define _SC_THREAD_CPUTIME 84
300 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
301 #define _SC_THREAD_KEYS_MAX 86
302 #define _SC_THREAD_PRIO_INHERIT 87
303 #define _SC_THREAD_PRIO_PROTECT 88
304 #define _SC_THREAD_PRIORITY_SCHEDULING 89
305 #define _SC_THREAD_PROCESS_SHARED 90
306 #define _SC_THREAD_SAFE_FUNCTIONS 91
307 #define _SC_THREAD_SPORADIC_SERVER 92
308 #define _SC_THREAD_STACK_MIN 93
309 #define _SC_THREAD_THREADS_MAX 94
310 #define _SC_TIMEOUTS 95
311 #define _SC_THREADS 96
313 #define _SC_TRACE_EVENT_FILTER 98
314 #define _SC_TRACE_INHERIT 99
315 #define _SC_TRACE_LOG 100
316 #define _SC_TTY_NAME_MAX 101
317 #define _SC_TYPED_MEMORY_OBJECTS 102
318 #define _SC_V6_ILP32_OFF32 103
319 #define _SC_V6_ILP32_OFFBIG 104
320 #define _SC_V6_LP64_OFF64 105
321 #define _SC_V6_LPBIG_OFFBIG 106
323 #define _SC_RAW_SOCKETS 119
324 #define _SC_SYMLOOP_MAX 120
325 #endif /* __DARWIN_C_LEVEL >= 200112L */
327 #if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
328 #define _SC_ATEXIT_MAX 107
329 #define _SC_IOV_MAX 56
330 #define _SC_PAGE_SIZE _SC_PAGESIZE
331 #define _SC_XOPEN_CRYPT 108
332 #define _SC_XOPEN_ENH_I18N 109
333 #define _SC_XOPEN_LEGACY 110 /* Issue 6 */
334 #define _SC_XOPEN_REALTIME 111 /* Issue 6 */
335 #define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
336 #define _SC_XOPEN_SHM 113
337 #define _SC_XOPEN_STREAMS 114 /* Issue 6 */
338 #define _SC_XOPEN_UNIX 115
339 #define _SC_XOPEN_VERSION 116
340 #define _SC_XOPEN_XCU_VERSION 121
343 #if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
344 /* Removed in Issue 7 */
345 #define _SC_XBS5_ILP32_OFF32 122
346 #define _SC_XBS5_ILP32_OFFBIG 123
347 #define _SC_XBS5_LP64_OFF64 124
348 #define _SC_XBS5_LPBIG_OFFBIG 125
349 #endif /* __DARWIN_C_LEVEL <= 200809L */
351 #if __DARWIN_C_LEVEL >= 200112L
352 #define _SC_SS_REPL_MAX 126
353 #define _SC_TRACE_EVENT_NAME_MAX 127
354 #define _SC_TRACE_NAME_MAX 128
355 #define _SC_TRACE_SYS_MAX 129
356 #define _SC_TRACE_USER_EVENT_MAX 130
359 #if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
360 /* Removed in Issue 6 */
361 #define _SC_PASS_MAX 131
364 /* 132-199 available for future use */
365 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
366 #define _SC_PHYS_PAGES 200
367 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
369 #if __DARWIN_C_LEVEL >= 199209L
370 #ifndef _CS_PATH /* Defined in <sys/unistd.h> */
375 #if __DARWIN_C_LEVEL >= 200112
376 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
377 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
378 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
379 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
380 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
381 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
382 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
383 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
384 #define _CS_POSIX_V6_LP64_OFF64_LIBS 10
385 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
386 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
387 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
388 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
391 #if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
392 /* Removed in Issue 7 */
393 #define _CS_XBS5_ILP32_OFF32_CFLAGS 20
394 #define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
395 #define _CS_XBS5_ILP32_OFF32_LIBS 22
396 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
397 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
398 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
399 #define _CS_XBS5_ILP32_OFFBIG_LIBS 26
400 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
401 #define _CS_XBS5_LP64_OFF64_CFLAGS 28
402 #define _CS_XBS5_LP64_OFF64_LDFLAGS 29
403 #define _CS_XBS5_LP64_OFF64_LIBS 30
404 #define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
405 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
406 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
407 #define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
408 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
411 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
412 #define _CS_DARWIN_USER_DIR 65536
413 #define _CS_DARWIN_USER_TEMP_DIR 65537
414 #define _CS_DARWIN_USER_CACHE_DIR 65538
415 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
418 #ifdef _DARWIN_UNLIMITED_GETGROUPS
419 #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
420 #error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
421 #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
422 #error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
429 void _exit(int) __dead2
;
430 int access(const char *, int);
433 int chdir(const char *);
434 int chown(const char *, uid_t
, gid_t
);
437 #ifndef LIBC_ALIAS_CLOSE
439 int close(int) __DARWIN_ALIAS_C(close
);
441 #else /* LIBC_ALIAS_CLOSE */
442 int close(int) LIBC_ALIAS_C(close
);
443 #endif /* !LIBC_ALIAS_CLOSE */
448 int execl(const char * __path
, const char * __arg0
, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
449 int execle(const char * __path
, const char * __arg0
, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
450 int execlp(const char * __file
, const char * __arg0
, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
451 int execv(const char * __path
, char * const * __argv
) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
452 int execve(const char * __file
, char * const * __argv
, char * const * __envp
) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
453 int execvp(const char * __file
, char * const * __argv
) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
454 pid_t
fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
455 long fpathconf(int, int);
456 char *getcwd(char *, size_t);
460 #if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
461 int getgroups(int, gid_t
[]) __DARWIN_ALIAS_STARTING(__MAC_10_6
, __IPHONE_3_2
, __DARWIN_EXTSN(getgroups
));
462 #else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
463 int getgroups(int, gid_t
[]);
464 #endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
465 char *getlogin(void);
471 int link(const char *, const char *);
472 off_t
lseek(int, off_t
, int);
473 long pathconf(const char *, int);
476 #ifndef LIBC_ALIAS_PAUSE
478 int pause(void) __DARWIN_ALIAS_C(pause
);
480 #else /* LIBC_ALIAS_PAUSE */
481 int pause(void) LIBC_ALIAS_C(pause
);
482 #endif /* !LIBC_ALIAS_PAUSE */
488 #ifndef LIBC_ALIAS_READ
490 ssize_t
read(int, void *, size_t) __DARWIN_ALIAS_C(read
);
492 #else /* LIBC_ALIAS_READ */
493 ssize_t
read(int, void *, size_t) LIBC_ALIAS_C(read
);
494 #endif /* !LIBC_ALIAS_READ */
497 int rmdir(const char *);
499 int setpgid(pid_t
, pid_t
);
504 #ifndef LIBC_ALIAS_SLEEP
507 sleep(unsigned int) __DARWIN_ALIAS_C(sleep
);
509 #else /* LIBC_ALIAS_SLEEP */
511 sleep(unsigned int) LIBC_ALIAS_C(sleep
);
512 #endif /* !LIBC_ALIAS_SLEEP */
516 pid_t
tcgetpgrp(int);
517 int tcsetpgrp(int, pid_t
);
522 #ifndef LIBC_ALIAS_TTYNAME_R
524 int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r
);
526 #else /* LIBC_ALIAS_TTYNAME_R */
527 int ttyname_r(int, char *, size_t) LIBC_ALIAS(ttyname_r
);
528 #endif /* !LIBC_ALIAS_TTYNAME_R */
530 #else /* !__DARWIN_UNIX03 */
531 char *ttyname_r(int, char *, size_t);
532 #endif /* __DARWIN_UNIX03 */
534 int unlink(const char *);
537 #ifndef LIBC_ALIAS_WRITE
539 ssize_t
write(int __fd
, const void * __buf
, size_t __nbyte
) __DARWIN_ALIAS_C(write
);
541 #else /* LIBC_ALIAS_WRITE */
542 ssize_t
write(int __fd
, const void * __buf
, size_t __nbyte
) LIBC_ALIAS_C(write
);
543 #endif /* !LIBC_ALIAS_WRITE */
549 /* Additional functionality provided by:
550 * POSIX.2-1992 C Language Binding Option
553 #if __DARWIN_C_LEVEL >= 199209L
556 #ifndef LIBC_ALIAS_CONFSTR
558 size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr
);
560 #else /* LIBC_ALIAS_CONFSTR */
561 size_t confstr(int, char *, size_t) LIBC_ALIAS(confstr
);
562 #endif /* !LIBC_ALIAS_CONFSTR */
566 #ifndef LIBC_ALIAS_GETOPT
568 int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt
);
570 #else /* LIBC_ALIAS_GETOPT */
571 int getopt(int, char * const [], const char *) LIBC_ALIAS(getopt
);
572 #endif /* !LIBC_ALIAS_GETOPT */
575 extern char *optarg
; /* getopt(3) external variables */
576 extern int optind
, opterr
, optopt
;
578 #endif /* __DARWIN_C_LEVEL >= 199209L */
582 /* Additional functionality provided by:
585 * and the omnibus ISO/IEC 9945-1: 1996
588 #if __DARWIN_C_LEVEL >= 199506L
589 /* These F_* are really XSI or Issue 6 */
590 #define F_ULOCK 0 /* unlock locked section */
591 #define F_LOCK 1 /* lock a section for exclusive use */
592 #define F_TLOCK 2 /* test and lock a section for exclusive use */
593 #define F_TEST 3 /* test a section for locks by other procs */
598 /* Removed in Issue 6 */
599 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
600 #if !defined(_POSIX_C_SOURCE)
601 __deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
603 void *brk(const void *);
604 int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
607 char *crypt(const char *, const char *);
608 #ifndef __CTERMID_DEFINED
609 /* Multiply defined in stdio.h and unistd.h by SUS */
610 #define __CTERMID_DEFINED 1
611 char *ctermid(char *);
615 #ifndef LIBC_ALIAS_ENCRYPT
617 void encrypt(char *, int) __DARWIN_ALIAS(encrypt
);
619 #else /* LIBC_ALIAS_ENCRYPT */
620 void encrypt(char *, int) LIBC_ALIAS(encrypt
);
621 #endif /* !LIBC_ALIAS_ENCRYPT */
623 #else /* !__DARWIN_UNIX03 */
624 int encrypt(char *, int);
625 #endif /* __DARWIN_UNIX03 */
627 long gethostid(void);
628 pid_t
getpgid(pid_t
);
631 /* Removed in Issue 6 */
632 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
633 int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
634 int getpagesize(void) __pure2
__POSIX_C_DEPRECATED(199506L);
635 char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
638 /* Removed in Issue 7 */
639 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
640 char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
644 #ifndef LIBC_ALIAS_LCHOWN
646 int lchown(const char *, uid_t
, gid_t
) __DARWIN_ALIAS(lchown
);
648 #else /* LIBC_ALIAS_LCHOWN */
649 int lchown(const char *, uid_t
, gid_t
) LIBC_ALIAS(lchown
);
650 #endif /* !LIBC_ALIAS_LCHOWN */
654 #ifndef LIBC_ALIAS_LOCKF
656 int lockf(int, int, off_t
) __DARWIN_ALIAS_C(lockf
);
658 #else /* LIBC_ALIAS_LOCKF */
659 int lockf(int, int, off_t
) LIBC_ALIAS_C(lockf
);
660 #endif /* !LIBC_ALIAS_LOCKF */
664 #ifndef LIBC_ALIAS_NICE
666 int nice(int) __DARWIN_ALIAS(nice
);
668 #else /* LIBC_ALIAS_NICE */
669 int nice(int) LIBC_ALIAS(nice
);
670 #endif /* !LIBC_ALIAS_NICE */
674 #ifndef LIBC_ALIAS_PREAD
676 ssize_t
pread(int __fd
, void * __buf
, size_t __nbyte
, off_t __offset
) __DARWIN_ALIAS_C(pread
);
678 #else /* LIBC_ALIAS_PREAD */
679 ssize_t
pread(int __fd
, void * __buf
, size_t __nbyte
, off_t __offset
) LIBC_ALIAS_C(pread
);
680 #endif /* !LIBC_ALIAS_PREAD */
684 #ifndef LIBC_ALIAS_PWRITE
686 ssize_t
pwrite(int __fd
, const void * __buf
, size_t __nbyte
, off_t __offset
) __DARWIN_ALIAS_C(pwrite
);
688 #else /* LIBC_ALIAS_PWRITE */
689 ssize_t
pwrite(int __fd
, const void * __buf
, size_t __nbyte
, off_t __offset
) LIBC_ALIAS_C(pwrite
);
690 #endif /* !LIBC_ALIAS_PWRITE */
693 /* Removed in Issue 6 */
694 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
695 /* Note that Issue 5 changed the argument as intprt_t,
696 * but we keep it as int for binary compatability. */
697 #if !defined(_POSIX_C_SOURCE)
698 __deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
705 #ifndef LIBC_ALIAS_SETPGRP
707 pid_t
setpgrp(void) __DARWIN_ALIAS(setpgrp
);
709 #else /* LIBC_ALIAS_SETPGRP */
710 pid_t
setpgrp(void) LIBC_ALIAS(setpgrp
);
711 #endif /* !LIBC_ALIAS_SETPGRP */
713 #else /* !__DARWIN_UNIX03 */
714 int setpgrp(pid_t pid
, pid_t pgrp
); /* obsoleted by setpgid() */
715 #endif /* __DARWIN_UNIX03 */
718 #ifndef LIBC_ALIAS_SETREGID
720 int setregid(gid_t
, gid_t
) __DARWIN_ALIAS(setregid
);
722 #else /* LIBC_ALIAS_SETREGID */
723 int setregid(gid_t
, gid_t
) LIBC_ALIAS(setregid
);
724 #endif /* !LIBC_ALIAS_SETREGID */
728 #ifndef LIBC_ALIAS_SETREUID
730 int setreuid(uid_t
, uid_t
) __DARWIN_ALIAS(setreuid
);
732 #else /* LIBC_ALIAS_SETREUID */
733 int setreuid(uid_t
, uid_t
) LIBC_ALIAS(setreuid
);
734 #endif /* !LIBC_ALIAS_SETREUID */
737 void swab(const void * __restrict
, void * __restrict
, ssize_t
);
739 int truncate(const char *, off_t
);
740 useconds_t
ualarm(useconds_t
, useconds_t
);
742 #ifndef LIBC_ALIAS_USLEEP
744 int usleep(useconds_t
) __DARWIN_ALIAS_C(usleep
);
746 #else /* LIBC_ALIAS_USLEEP */
747 int usleep(useconds_t
) LIBC_ALIAS_C(usleep
);
748 #endif /* !LIBC_ALIAS_USLEEP */
750 pid_t
vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
754 #ifndef LIBC_ALIAS_FSYNC
756 int fsync(int) __DARWIN_ALIAS_C(fsync
);
758 #else /* LIBC_ALIAS_FSYNC */
759 int fsync(int) LIBC_ALIAS_C(fsync
);
760 #endif /* !LIBC_ALIAS_FSYNC */
763 int ftruncate(int, off_t
);
764 int getlogin_r(char *, size_t);
766 #endif /* __DARWIN_C_LEVEL >= 199506L */
770 /* Additional functionality provided by:
775 #if __DARWIN_C_LEVEL >= 200112L
777 int fchown(int, uid_t
, gid_t
);
778 int gethostname(char *, size_t);
779 ssize_t
readlink(const char * __restrict
, char * __restrict
, size_t);
782 int symlink(const char *, const char *);
784 #endif /* __DARWIN_C_LEVEL >= 200112L */
788 /* Darwin extensions */
790 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
791 #include <sys/select.h>
793 #include <sys/_types/_dev_t.h>
794 #include <sys/_types/_mode_t.h>
795 #include <sys/_types/_uuid_t.h>
798 void _Exit(int) __dead2
;
799 int accessx_np(const struct accessx_descriptor
*, size_t, int *, uid_t
);
800 int acct(const char *);
801 int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
802 void endusershell(void);
803 int execvP(const char * __file
, const char * __searchpath
, char * const * __argv
) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
804 char *fflagstostr(unsigned long);
805 int getdomainname(char *, int);
806 int getgrouplist(const char *, int, int *, int *);
807 #if defined(__has_include)
808 #if __has_include(<gethostuuid_private.h>)
809 #include <gethostuuid_private.h>
811 #include <gethostuuid.h>
814 #include <gethostuuid.h>
816 mode_t
getmode(const void *, mode_t
);
817 int getpeereid(int, uid_t
*, gid_t
*);
818 int getsgroups_np(int *, uuid_t
);
819 char *getusershell(void);
820 int getwgroups_np(int *, uuid_t
);
821 int initgroups(const char *, int);
823 char *mkdtemp(char *);
824 int mknod(const char *, mode_t
, dev_t
);
825 int mkpath_np(const char *path
, mode_t omode
) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_5_0
); /* returns errno */
826 int mkpathat_np(int dfd
, const char *path
, mode_t omode
) /* returns errno */
827 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
828 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
830 int mkstemps(char *, int);
831 char *mktemp(char *);
832 int mkostemp(char *path
, int oflags
)
833 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
834 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
835 int mkostemps(char *path
, int slen
, int oflags
)
836 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
837 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
838 /* Non-portable mkstemp that uses open_dprotected_np */
839 int mkstemp_dprotected_np(char *path
, int dpclass
, int dpflags
)
840 __OSX_UNAVAILABLE
__IOS_AVAILABLE(10.0)
841 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
842 int nfssvc(int, void *);
843 int profil(char *, size_t, unsigned long, unsigned int);
844 int pthread_setugid_np(uid_t
, gid_t
);
845 int pthread_getugid_np( uid_t
*, gid_t
*);
847 int revoke(const char *);
849 __deprecated
int rcmd(char **, int, const char *, const char *, const char *, int *);
850 __deprecated
int rcmd_af(char **, int, const char *, const char *, const char *, int *,
852 __deprecated
int rresvport(int *);
853 __deprecated
int rresvport_af(int *, int);
854 __deprecated
int iruserok(unsigned long, int, const char *, const char *);
855 __deprecated
int iruserok_sa(const void *, int, int, const char *, const char *);
856 __deprecated
int ruserok(const char *, int, const char *, const char *);
858 int setdomainname(const char *, int);
859 int setgroups(int, const gid_t
*);
860 void sethostid(long);
861 int sethostname(const char *, int);
864 #ifndef LIBC_ALIAS_SETKEY
866 void setkey(const char *) __DARWIN_ALIAS(setkey
);
868 #else /* LIBC_ALIAS_SETKEY */
869 void setkey(const char *) LIBC_ALIAS(setkey
);
870 #endif /* !LIBC_ALIAS_SETKEY */
872 #else /* !__DARWIN_UNIX03 */
873 int setkey(const char *);
874 #endif /* __DARWIN_UNIX03 */
875 int setlogin(const char *);
877 #ifndef LIBC_ALIAS_SETMODE
879 void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6
, __IPHONE_2_0
, __DARWIN_ALIAS(setmode
));
881 #else /* LIBC_ALIAS_SETMODE */
882 void *setmode(const char *) LIBC_ALIAS(setmode
);
883 #endif /* !LIBC_ALIAS_SETMODE */
887 int setsgroups_np(int, const uuid_t
);
888 void setusershell(void);
889 int setwgroups_np(int, const uuid_t
);
890 int strtofflags(char **, unsigned long *, unsigned long *);
891 int swapon(const char *);
893 int undelete(const char *);
894 int unwhiteout(const char *);
895 void *valloc(size_t);
897 __WATCHOS_PROHIBITED __TVOS_PROHIBITED
898 __OS_AVAILABILITY_MSG(ios
,deprecated
=10.0,"syscall(2) is unsupported; "
899 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
900 __OS_AVAILABILITY_MSG(macosx
,deprecated
=10.12,"syscall(2) is unsupported; "
901 "please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
902 int syscall(int, ...);
904 extern char *suboptarg
; /* getsubopt(3) external variable */
905 int getsubopt(char **, char * const *, char **);
907 /* HFS & HFS Plus semantics system calls go here */
909 int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
910 int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
912 #ifndef LIBC_ALIAS_GETATTRLIST
914 int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist
);
916 #else /* LIBC_ALIAS_GETATTRLIST */
917 int getattrlist(const char*,void*,void*,size_t,unsigned int) LIBC_ALIAS(getattrlist
);
918 #endif /* !LIBC_ALIAS_GETATTRLIST */
921 #ifndef LIBC_ALIAS_SETATTRLIST
923 int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist
);
925 #else /* LIBC_ALIAS_SETATTRLIST */
926 int setattrlist(const char*,void*,void*,size_t,unsigned int) LIBC_ALIAS(setattrlist
);
927 #endif /* !LIBC_ALIAS_SETATTRLIST */
929 int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
930 int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
933 int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
934 int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
936 #ifndef LIBC_ALIAS_GETATTRLIST
938 int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist
);
940 #else /* LIBC_ALIAS_GETATTRLIST */
941 int getattrlist(const char*,void*,void*,size_t,unsigned long) LIBC_ALIAS(getattrlist
);
942 #endif /* !LIBC_ALIAS_GETATTRLIST */
945 #ifndef LIBC_ALIAS_SETATTRLIST
947 int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist
);
949 #else /* LIBC_ALIAS_SETATTRLIST */
950 int setattrlist(const char*,void*,void*,size_t,unsigned long) LIBC_ALIAS(setattrlist
);
951 #endif /* !LIBC_ALIAS_SETATTRLIST */
953 int exchangedata(const char*,const char*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
954 int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
956 #endif /* __LP64__ */
958 struct fssearchblock
;
961 int searchfs(const char *, struct fssearchblock
*, unsigned long *, unsigned int, unsigned int, struct searchstate
*) __WATCHOS_PROHIBITED __TVOS_PROHIBITED
;
962 int fsctl(const char *,unsigned long,void*,unsigned int);
963 int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_3_0
);
965 #define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
966 #define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
968 int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
969 int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8
, __IPHONE_6_0
);
974 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
976 #endif /* _UNISTD_H_ */