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