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