nrelease: Reorder and clean up the "srcs" target
[dragonfly.git] / include / unistd.h
1 /*-
2  * Copyright (c) 1991, 1993, 1994
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *      @(#)unistd.h    8.12 (Berkeley) 4/27/95
30  * $FreeBSD: src/include/unistd.h,v 1.93 2009/03/14 19:11:08 das Exp $
31  */
32
33 #ifndef _UNISTD_H_
34 #define _UNISTD_H_
35
36 #include <sys/cdefs.h>
37 #include <sys/types.h>                  /* XXX adds too much pollution. */
38 #include <sys/unistd.h>
39 #include <sys/_null.h>
40
41 #if __XSI_VISIBLE
42 #ifndef _INTPTR_T_DECLARED
43 typedef __intptr_t      intptr_t;
44 #define _INTPTR_T_DECLARED
45 #endif
46 #endif /* __XSI_VISIBLE */
47
48 #ifndef _GID_T_DECLARED
49 typedef __uint32_t      gid_t;          /* XXX __gid_t */
50 #define _GID_T_DECLARED
51 #endif
52
53 #ifndef _OFF_T_DECLARED
54 typedef __off_t         off_t;
55 #define _OFF_T_DECLARED
56 #endif
57
58 #ifndef _PID_T_DECLARED
59 typedef __pid_t         pid_t;
60 #define _PID_T_DECLARED
61 #endif
62
63 #ifndef _SIZE_T_DECLARED
64 typedef __size_t        size_t;         /* _GCC_SIZE_T OK */
65 #define _SIZE_T_DECLARED
66 #endif
67
68 #ifndef _SSIZE_T_DECLARED
69 typedef __ssize_t       ssize_t;
70 #define _SSIZE_T_DECLARED
71 #endif
72
73 #ifndef _UID_T_DECLARED
74 typedef __uint32_t      uid_t;          /* XXX __uid_t */
75 #define _UID_T_DECLARED
76 #endif
77
78 #define  STDIN_FILENO   0       /* standard input file descriptor */
79 #define STDOUT_FILENO   1       /* standard output file descriptor */
80 #define STDERR_FILENO   2       /* standard error file descriptor */
81
82 #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
83 #define F_ULOCK         0       /* unlock locked section */
84 #define F_LOCK          1       /* lock a section for exclusive use */
85 #define F_TLOCK         2       /* test and lock a section for exclusive use */
86 #define F_TEST          3       /* test a section for locks by other procs */
87 #endif
88
89 /*
90  * Extended API support (DragonFly specific)
91  */
92 #if __BSD_VISIBLE
93
94 #define _HAVE_EXTEXIT           1
95 #define _HAVE_EXTPREAD          1
96 #define _HAVE_EXTPREADV         1
97 #define _HAVE_EXTPWRITE         1
98 #define _HAVE_EXTPWRITEV        1
99
100 #endif
101
102 /*
103  * POSIX options and option groups we unconditionally do or don't
104  * implement.  This list includes those options which are exclusively
105  * implemented (or not) in user mode.  Please keep this list in
106  * alphabetical order.
107  *
108  * Anything which is defined as zero below **must** have an
109  * implementation for the corresponding sysconf() which is able to
110  * determine conclusively whether or not the feature is supported.
111  * Anything which is defined as other than -1 below **must** have
112  * complete headers, types, and function declarations as specified by
113  * the POSIX standard; however, if the relevant sysconf() function
114  * returns -1, the functions may be stubbed out.
115  */
116 #define _POSIX_READER_WRITER_LOCKS      200112L /* mandatory ([THR]) */
117 #define _POSIX_REGEXP                   1       /* mandatory */
118 #define _POSIX_SHELL                    1       /* mandatory */
119 #define _POSIX_SPAWN                    200112L /* [SPN] */
120 #define _POSIX_THREAD_ATTR_STACKADDR    200112L /* [TSA] */
121 #define _POSIX_THREAD_ATTR_STACKSIZE    200112L /* [TSS] */
122 #define _POSIX_THREAD_PRIO_INHERIT      200112L /* [TPI] */
123 #define _POSIX_THREAD_PRIO_PROTECT      200112L /* [TPP] */
124 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L /* [TPS] */
125 #define _POSIX_THREAD_PROCESS_SHARED    -1      /* [TSH] */
126 #define _POSIX_THREAD_ROBUST_PRIO_INHERIT -1    /* [RPI] */
127 #define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1    /* [RPP] */
128 #define _POSIX_THREAD_SAFE_FUNCTIONS    200112L /* mandatory ([TSF]) */
129 #define _POSIX_THREAD_SPORADIC_SERVER   -1      /* [TSP] */
130 #define _POSIX_THREADS                  200112L /* mandatory ([THR]) */
131 #define _POSIX_TRACE                    -1      /* [TRC] obsolescent */
132 #define _POSIX_TRACE_EVENT_FILTER       -1      /* [TEF] obsolescent */
133 #define _POSIX_TRACE_INHERIT            -1      /* [TRI] obsolescent */
134 #define _POSIX_TRACE_LOG                -1      /* [TRL] obsolescent */
135
136 #define _POSIX2_C_BIND                  200809L /* mandatory */
137 #define _POSIX2_C_DEV                   200809L /* [CD] */
138 #define _POSIX2_CHAR_TERM               1
139 #define _POSIX2_FORT_DEV                -1      /* [FD] obsolescent */
140 #define _POSIX2_FORT_RUN                200809L /* [FR] */
141 #define _POSIX2_LOCALEDEF               200809L
142 #define _POSIX2_PBS                     -1      /* [BE] obsolescent */
143 #define _POSIX2_PBS_ACCOUNTING          -1      /* [BE] obsolescent */
144 #define _POSIX2_PBS_CHECKPOINT          -1      /* [BE] obsolescent */
145 #define _POSIX2_PBS_LOCATE              -1      /* [BE] obsolescent */
146 #define _POSIX2_PBS_MESSAGE             -1      /* [BE] obsolescent */
147 #define _POSIX2_PBS_TRACK               -1      /* [BE] obsolescent */
148 #define _POSIX2_SW_DEV                  200809L /* [SD] */
149 #define _POSIX2_UPE                     200809L /* [UP] */
150
151 #define _V6_ILP32_OFF32                 -1
152 #define _V6_ILP32_OFFBIG                0
153 #define _V6_LP64_OFF64                  0
154 #define _V6_LPBIG_OFFBIG                -1
155
156 #define _V7_ILP32_OFF32                 -1
157 #define _V7_ILP32_OFFBIG                0
158 #define _V7_LP64_OFF64                  0
159 #define _V7_LPBIG_OFFBIG                -1
160
161 #if __XSI_VISIBLE
162 #define _XOPEN_CRYPT                    -1
163 #define _XOPEN_ENH_I18N                 1       /* mandatory */
164 #define _XOPEN_LEGACY                   -1      /* until _XOPEN_SOURCE < 700 */
165 #define _XOPEN_REALTIME                 -1      /* missing: [ML] and [SIO] */
166 #define _XOPEN_REALTIME_THREADS         -1      /* missing: [RPI] and [RPP] */
167 #define _XOPEN_UNIX                     -1
168 #endif
169
170 /* Define the POSIX.2 version we target for compliance. */
171 #define _POSIX2_VERSION         199212L
172
173 /*
174  * POSIX-style system configuration variable accessors (for the
175  * sysconf function).  The kernel does not directly implement the
176  * sysconf() interface; rather, a C library stub translates references
177  * to sysconf() into calls to sysctl() using a giant switch statement.
178  * Those that are marked `user' are implemented entirely in the C
179  * library and never query the kernel.  pathconf() is implemented
180  * directly by the kernel so those are not defined here.
181  */
182 #define _SC_ARG_MAX              1
183 #define _SC_CHILD_MAX            2
184 #define _SC_CLK_TCK              3
185 #define _SC_NGROUPS_MAX          4
186 #define _SC_OPEN_MAX             5
187 #define _SC_JOB_CONTROL          6
188 #define _SC_SAVED_IDS            7
189 #define _SC_VERSION              8
190 #define _SC_BC_BASE_MAX          9 /* user */
191 #define _SC_BC_DIM_MAX          10 /* user */
192 #define _SC_BC_SCALE_MAX        11 /* user */
193 #define _SC_BC_STRING_MAX       12 /* user */
194 #define _SC_COLL_WEIGHTS_MAX    13 /* user */
195 #define _SC_EXPR_NEST_MAX       14 /* user */
196 #define _SC_LINE_MAX            15 /* user */
197 #define _SC_RE_DUP_MAX          16 /* user */
198 #define _SC_2_VERSION           17 /* user */
199 #define _SC_2_C_BIND            18 /* user */
200 #define _SC_2_C_DEV             19 /* user */
201 #define _SC_2_CHAR_TERM         20 /* user */
202 #define _SC_2_FORT_DEV          21 /* user */
203 #define _SC_2_FORT_RUN          22 /* user */
204 #define _SC_2_LOCALEDEF         23 /* user */
205 #define _SC_2_SW_DEV            24 /* user */
206 #define _SC_2_UPE               25 /* user */
207 #define _SC_STREAM_MAX          26 /* user */
208 #define _SC_TZNAME_MAX          27 /* user */
209
210 #if __POSIX_VISIBLE >= 199309
211 #define _SC_ASYNCHRONOUS_IO     28
212 #define _SC_MAPPED_FILES        29
213 #define _SC_MEMLOCK             30
214 #define _SC_MEMLOCK_RANGE       31
215 #define _SC_MEMORY_PROTECTION   32
216 #define _SC_MESSAGE_PASSING     33
217 #define _SC_PRIORITIZED_IO      34
218 #define _SC_PRIORITY_SCHEDULING 35
219 #define _SC_REALTIME_SIGNALS    36
220 #define _SC_SEMAPHORES          37
221 #define _SC_FSYNC               38
222 #define _SC_SHARED_MEMORY_OBJECTS 39
223 #define _SC_SYNCHRONIZED_IO     40
224 #define _SC_TIMERS              41
225 #define _SC_AIO_LISTIO_MAX      42
226 #define _SC_AIO_MAX             43
227 #define _SC_AIO_PRIO_DELTA_MAX  44
228 #define _SC_DELAYTIMER_MAX      45
229 #define _SC_MQ_OPEN_MAX         46
230 #define _SC_PAGESIZE            47
231 #define _SC_RTSIG_MAX           48
232 #define _SC_SEM_NSEMS_MAX       49
233 #define _SC_SEM_VALUE_MAX       50
234 #define _SC_SIGQUEUE_MAX        51
235 #define _SC_TIMER_MAX           52
236 #endif
237
238 #if __POSIX_VISIBLE >= 200112
239 #define _SC_2_PBS               59 /* user */
240 #define _SC_2_PBS_ACCOUNTING    60 /* user */
241 #define _SC_2_PBS_CHECKPOINT    61 /* user */
242 #define _SC_2_PBS_LOCATE        62 /* user */
243 #define _SC_2_PBS_MESSAGE       63 /* user */
244 #define _SC_2_PBS_TRACK         64 /* user */
245 #define _SC_ADVISORY_INFO       65
246 #define _SC_BARRIERS            66 /* user */
247 #define _SC_CLOCK_SELECTION     67
248 #define _SC_CPUTIME             68
249 #define _SC_FILE_LOCKING        69
250 #define _SC_GETGR_R_SIZE_MAX    70 /* user */
251 #define _SC_GETPW_R_SIZE_MAX    71 /* user */
252 #define _SC_HOST_NAME_MAX       72
253 #define _SC_LOGIN_NAME_MAX      73
254 #define _SC_MONOTONIC_CLOCK     74
255 #define _SC_MQ_PRIO_MAX         75
256 #define _SC_READER_WRITER_LOCKS 76 /* user */
257 #define _SC_REGEXP              77 /* user */
258 #define _SC_SHELL               78 /* user */
259 #define _SC_SPAWN               79 /* user */
260 #define _SC_SPIN_LOCKS          80 /* user */
261 #define _SC_SPORADIC_SERVER     81
262 #define _SC_THREAD_ATTR_STACKADDR 82 /* user */
263 #define _SC_THREAD_ATTR_STACKSIZE 83 /* user */
264 #define _SC_THREAD_CPUTIME      84 /* user */
265 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
266 #define _SC_THREAD_KEYS_MAX     86 /* user */
267 #define _SC_THREAD_PRIO_INHERIT 87 /* user */
268 #define _SC_THREAD_PRIO_PROTECT 88 /* user */
269 #define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
270 #define _SC_THREAD_PROCESS_SHARED 90 /* user */
271 #define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */
272 #define _SC_THREAD_SPORADIC_SERVER 92 /* user */
273 #define _SC_THREAD_STACK_MIN    93 /* user */
274 #define _SC_THREAD_THREADS_MAX  94 /* user */
275 #define _SC_TIMEOUTS            95 /* user */
276 #define _SC_THREADS             96 /* user */
277 #define _SC_TRACE               97 /* user */
278 #define _SC_TRACE_EVENT_FILTER  98 /* user */
279 #define _SC_TRACE_INHERIT       99 /* user */
280 #define _SC_TRACE_LOG           100 /* user */
281 #define _SC_TTY_NAME_MAX        101 /* user */
282 #define _SC_TYPED_MEMORY_OBJECTS 102
283 #define _SC_V6_ILP32_OFF32      103 /* user */
284 #define _SC_V6_ILP32_OFFBIG     104 /* user */
285 #define _SC_V6_LP64_OFF64       105 /* user */
286 #define _SC_V6_LPBIG_OFFBIG     106 /* user */
287 #define _SC_IPV6                118
288 #define _SC_RAW_SOCKETS         119
289 #define _SC_SYMLOOP_MAX         120
290 #endif
291
292 #if __XSI_VISIBLE
293 #define _SC_ATEXIT_MAX          107 /* user */
294 #define _SC_IOV_MAX             56
295 #define _SC_PAGE_SIZE           _SC_PAGESIZE
296 #define _SC_XOPEN_CRYPT         108 /* user */
297 #define _SC_XOPEN_ENH_I18N      109 /* user */
298 #define _SC_XOPEN_LEGACY        110 /* user */
299 #define _SC_XOPEN_REALTIME      111
300 #define _SC_XOPEN_REALTIME_THREADS 112
301 #define _SC_XOPEN_SHM           113
302 #define _SC_XOPEN_STREAMS       114
303 #define _SC_XOPEN_UNIX          115
304 #define _SC_XOPEN_VERSION       116
305 #define _SC_XOPEN_XCU_VERSION   117 /* user */
306 #endif
307
308 #if __BSD_VISIBLE
309 #define _SC_NPROCESSORS_CONF    57
310 #define _SC_NPROCESSORS_ONLN    58
311 #define _SC_LEVEL1_DCACHE_LINESIZE 128
312 #endif
313
314 /* Extensions found in Solaris and Linux. */
315 #define _SC_PHYS_PAGES          121
316
317 #if __POSIX_VISIBLE >= 200809
318 #define _SC_V7_ILP32_OFF32      122 /* user */
319 #define _SC_V7_ILP32_OFFBIG     123 /* user */
320 #define _SC_V7_LP64_OFF64       124 /* user */
321 #define _SC_V7_LPBIG_OFFBIG     125 /* user */
322 #define _SC_THREAD_ROBUST_PRIO_INHERIT 126 /* user */
323 #define _SC_THREAD_ROBUST_PRIO_PROTECT 127 /* user */
324 #endif
325
326 /* Keys for the confstr(3) function. */
327 #if __POSIX_VISIBLE >= 199209
328 #define _CS_PATH                1       /* default value of PATH */
329 #endif
330
331 #if __POSIX_VISIBLE >= 200112
332 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS         2
333 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS        3
334 #define _CS_POSIX_V6_ILP32_OFF32_LIBS           4
335 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS        5
336 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS       6
337 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS          7
338 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS          8
339 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS         9
340 #define _CS_POSIX_V6_LP64_OFF64_LIBS            10
341 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS        11
342 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS       12
343 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS          13
344 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS      14
345 #endif
346
347 #if __POSIX_VISIBLE >= 200809
348 #define _CS_POSIX_V7_ILP32_OFF32_CFLAGS         15
349 #define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS        16
350 #define _CS_POSIX_V7_ILP32_OFF32_LIBS           17
351 #define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS        18
352 #define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS       19
353 #define _CS_POSIX_V7_ILP32_OFFBIG_LIBS          20
354 #define _CS_POSIX_V7_LP64_OFF64_CFLAGS          21
355 #define _CS_POSIX_V7_LP64_OFF64_LDFLAGS         22
356 #define _CS_POSIX_V7_LP64_OFF64_LIBS            23
357 #define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS        24
358 #define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS       25
359 #define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS          26
360 #define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS      27
361 #endif
362
363 __BEGIN_DECLS
364 /* 1003.1-1990 */
365 void     _exit(int) __dead2;
366 int      access(const char *, int);
367 unsigned int     alarm(unsigned int);
368 int      chdir(const char *);
369 int      chown(const char *, uid_t, gid_t);
370 int      close(int);
371 int      dup(int);
372 int      dup2(int, int);
373 int      execl(const char *, const char *, ...);
374 int      execle(const char *, const char *, ...);
375 int      execlp(const char *, const char *, ...);
376 int      execv(const char *, char * const *);
377 int      execve(const char *, char * const *, char * const *);
378 int      execvp(const char *, char * const *);
379 pid_t    fork(void);
380 long     fpathconf(int, int);
381 char    *getcwd(char *, size_t);
382 gid_t    getegid(void);
383 uid_t    geteuid(void);
384 gid_t    getgid(void);
385 int      getgroups(int, gid_t []);
386 char    *getlogin(void);
387 pid_t    getpgrp(void);
388 pid_t    getpid(void);
389 pid_t    getppid(void);
390 uid_t    getuid(void);
391 int      isatty(int);
392 int      link(const char *, const char *);
393 off_t    lseek(int, off_t, int);
394 long     pathconf(const char *, int);
395 int      pause(void);
396 int      pipe(int *);
397 int      pipe2(int *, int);
398 ssize_t  read(int, void *, size_t);
399 int      rmdir(const char *);
400 int      setgid(gid_t);
401 int      setpgid(pid_t, pid_t);
402 pid_t    setsid(void);
403 int      setuid(uid_t);
404 unsigned int     sleep(unsigned int);
405 long     sysconf(int);
406 pid_t    tcgetpgrp(int);
407 int      tcsetpgrp(int, pid_t);
408 char    *ttyname(int);
409 int      ttyname_r(int, char *, size_t);
410 int      unlink(const char *);
411 ssize_t  write(int, const void *, size_t);
412
413 /* 1003.2-1992 */
414 #if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
415 size_t   confstr(int, char *, size_t);
416 #ifndef _GETOPT_DECLARED
417 #define _GETOPT_DECLARED
418 int      getopt(int, char * const [], const char *);
419
420 extern char *optarg;                    /* getopt(3) external variables */
421 extern int optind, opterr, optopt;
422 #endif /* _GETOPT_DECLARED */
423 #endif
424
425 /* ISO/IEC 9945-1: 1996 */
426 #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
427 int      fsync(int);
428
429 /*
430  * ftruncate() was in the POSIX Realtime Extension (it's used for shared
431  * memory), but truncate() was not.
432  */
433 int      ftruncate(int, off_t);
434 #endif
435
436 #if __POSIX_VISIBLE >= 199506
437 int      getlogin_r(char *, int);
438 #endif
439
440 /* 1003.1-2001 */
441 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
442 int      fchown(int, uid_t, gid_t);
443 ssize_t  readlink(const char * __restrict, char * __restrict, size_t);
444 #endif
445 #if __POSIX_VISIBLE >= 200112
446 int      gethostname(char *, size_t);
447 int      setegid(gid_t);
448 int      seteuid(uid_t);
449 #endif
450
451 /* 1003.1-2008 */
452 #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
453 int      getsid(pid_t _pid);
454 int      fchdir(int);
455 int      getpgid(pid_t _pid);
456 int      lchown(const char *, uid_t, gid_t);
457 #ifndef _MKDTEMP_DECLARED
458 char    *mkdtemp(char *);
459 #define _MKDTEMP_DECLARED
460 #endif
461 #ifndef _MKSTEMP_DECLARED
462 int      mkstemp(char *);
463 #define _MKSTEMP_DECLARED
464 #endif
465 ssize_t  pread(int, void *, size_t, off_t);
466 ssize_t  pwrite(int, const void *, size_t, off_t);
467
468 /* See comment at ftruncate() above. */
469 int      truncate(const char *, off_t);
470 #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
471
472 #if __POSIX_VISIBLE >= 200809
473 int     faccessat(int, const char *, int, int);
474 int     fchownat(int, const char *, uid_t, gid_t, int);
475 #if 0
476 int     fexecve(int, char *const [], char *const []);
477 #endif
478 int     linkat(int, const char *, int, const char *, int);
479 ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t);
480 int     symlinkat(const char *, int, const char *);
481 int     unlinkat(int, const char *, int);
482 #endif /* __POSIX_VISIBLE >= 200809 */
483
484 /*
485  * symlink() was originally in POSIX.1a, which was withdrawn after
486  * being overtaken by events (1003.1-2001).  It was in XPG4.2, and of
487  * course has been in BSD since 4.2.
488  */
489 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402
490 int      symlink(const char *, const char *);
491 #endif
492
493 /* X/Open System Interfaces */
494 #if __XSI_VISIBLE
495 char    *crypt(const char *, const char *);
496 int      encrypt(char *, int);
497 long     gethostid(void);
498 int      lockf(int, int, off_t);
499 int      nice(int);
500 int      setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
501 int      setregid(gid_t, gid_t);
502 int      setreuid(uid_t, uid_t);
503 void     swab(const void * __restrict, void * __restrict, ssize_t);
504 void     sync(void);
505 #endif /* __XSI_VISIBLE */
506
507 #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)
508 int      chroot(const char *);
509 int      chroot_kernel(const char *);
510 int      getdtablesize(void);
511 int      getpagesize(void) __pure2;
512 char    *getpass(const char *);
513 void    *sbrk(intptr_t);
514 #endif
515
516 #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 700)
517 char    *getwd(char *);                 /* LEGACY (obsoleted by getcwd()) */
518 unsigned int
519          ualarm(unsigned int, unsigned int);
520 int      usleep(unsigned int);
521 pid_t    vfork(void) __returns_twice;
522 #endif
523
524 #if __BSD_VISIBLE
525 struct iovec;
526 int      acct(const char *);
527 int      async_daemon(void);
528 int      closefrom(int);
529 const char *
530          crypt_get_format(void);
531 int      crypt_set_format(const char *);
532 int      dup3(int, int, int);
533 int      eaccess(const char *, int);
534 void     endusershell(void);
535 int      exect(const char *, char * const *, char * const *);
536 int      execvP(const char *, const char *, char * const *);
537 void     extexit(int, int, void *);
538 ssize_t  extpread(int, void *, size_t, int, off_t);
539 ssize_t  extpreadv(int, const struct iovec *, int, int, off_t);
540 ssize_t  extpwrite(int, const void *, size_t, int, off_t);
541 ssize_t  extpwritev(int, const struct iovec *, int, int, off_t);
542 char    *fflagstostr(unsigned long);
543 int      getdomainname(char *, int);
544 int      getgrouplist(const char *, gid_t, gid_t *, int *);
545 mode_t   getmode(const void *, mode_t);
546 int      getosreldate(void);
547 int      getpeereid(int, uid_t *, gid_t *);
548 int      getresgid(gid_t *, gid_t *, gid_t *);
549 int      getresuid(uid_t *, uid_t *, uid_t *);
550 char    *getusershell(void);
551 int      initgroups(const char *, gid_t);
552 int      iruserok(unsigned long, int, const char *, const char *);
553 int      iruserok_sa(const void *, int, int, const char *, const char *);
554 int      issetugid(void);
555 long     lpathconf(const char *, int);
556 #ifndef _LWP_GETTID_DECLARED
557 lwpid_t  lwp_gettid(void);
558 #define _LWP_GETTID_DECLARED
559 #endif
560 #ifndef _LWP_SETNAME_DECLARED
561 int     lwp_setname(lwpid_t, const char *);
562 #define _LWP_SETNAME_DECLARED
563 #endif
564 #ifndef _MKNOD_DECLARED
565 int      mknod(const char *, mode_t, dev_t);
566 #define _MKNOD_DECLARED
567 #endif
568 int      mkstemps(char *, int);
569 #ifndef _MKTEMP_DECLARED
570 char    *mktemp(char *);
571 #define _MKTEMP_DECLARED
572 #endif
573 int      nfssvc(int, void *);
574 int      profil(char *, size_t, unsigned long, unsigned int);
575 int      rcmd(char **, int, const char *, const char *, const char *, int *);
576 int      rcmd_af(char **, int, const char *, const char *, const char *, int *,
577                  int);
578 int      rcmdsh(char **, int, const char *, const char *, const char *,
579                 const char *);
580 char    *re_comp(const char *);
581 int      re_exec(const char *);
582 int      reboot(int);
583 int      revoke(const char *);
584 pid_t    rfork(int);
585 pid_t    rfork_thread(int, void *, int (*)(void *), void *);
586 int      rresvport(int *);
587 int      rresvport_af(int *, int);
588 int      ruserok(const char *, int, const char *, const char *);
589 int      setdomainname(const char *, int);
590 int      setgroups(int, const gid_t *);
591 void     sethostid(long);
592 int      sethostname(const char *, int);
593 int      setlogin(const char *);
594 void    *setmode(const char *);
595 void     setproctitle(const char *_fmt, ...) __printf0like(1, 2);
596 int      setresgid(gid_t, gid_t, gid_t);
597 int      setresuid(uid_t, uid_t, uid_t);
598 int      setrgid(gid_t);
599 int      setruid(uid_t);
600 void     setusershell(void);
601 int      strtofflags(char **, unsigned long *, unsigned long *);
602 int      swapoff(const char *);
603 int      swapon(const char *);
604 int      syscall(int, ...);
605 off_t    __syscall(quad_t, ...);
606 int      umtx_sleep(volatile const int *, int , int);
607 int      umtx_wakeup(volatile const int *, int);
608 int      undelete(const char *);
609 void    *valloc(size_t);                        /* obsoleted by malloc() */
610 int      varsym_get(int, const char *, char *, int);
611 int      varsym_list(int, char *, int, int *);
612 int      varsym_set(int, const char *, const char *);
613
614 #ifndef _OPTRESET_DECLARED
615 #define _OPTRESET_DECLARED
616 extern int optreset;                    /* getopt(3) external variable */
617 #endif
618 #endif /* __BSD_VISIBLE */
619 __END_DECLS
620
621 #endif /* !_UNISTD_H_ */