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