unistd.h revision 103929
122347Spst/*-
222347Spst * Copyright (c) 1991, 1993, 1994
322347Spst *	The Regents of the University of California.  All rights reserved.
429964Sache *
522347Spst * Redistribution and use in source and binary forms, with or without
622347Spst * modification, are permitted provided that the following conditions
722347Spst * are met:
822347Spst * 1. Redistributions of source code must retain the above copyright
922347Spst *    notice, this list of conditions and the following disclaimer.
1022347Spst * 2. Redistributions in binary form must reproduce the above copyright
1122347Spst *    notice, this list of conditions and the following disclaimer in the
1222347Spst *    documentation and/or other materials provided with the distribution.
1322347Spst * 3. All advertising materials mentioning features or use of this software
1422347Spst *    must display the following acknowledgement:
1529964Sache *	This product includes software developed by the University of
1629964Sache *	California, Berkeley and its contributors.
1722347Spst * 4. Neither the name of the University nor the names of its contributors
1829964Sache *    may be used to endorse or promote products derived from this software
1929964Sache *    without specific prior written permission.
2029964Sache *
2129964Sache * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2229964Sache * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2329964Sache * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2429964Sache * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2529964Sache * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2629964Sache * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2729964Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2829964Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2929964Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3029964Sache * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3129964Sache * SUCH DAMAGE.
3229964Sache *
3322347Spst *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
3429964Sache * $FreeBSD: head/include/unistd.h 103929 2002-09-25 01:58:56Z wollman $
3529964Sache */
3629964Sache
3729964Sache#ifndef _UNISTD_H_
3822347Spst#define	_UNISTD_H_
3922347Spst
4022347Spst#include <sys/cdefs.h>
4122347Spst#include <sys/types.h>			/* XXX adds too much pollution. */
4222347Spst#include <sys/unistd.h>
4322347Spst#include <sys/_types.h>
4422347Spst
4522347Spst#ifndef _GID_T_DECLARED
4622347Spsttypedef	__gid_t		gid_t;
4722347Spst#define	_GID_T_DECLARED
4822347Spst#endif
4922347Spst
5022347Spst#ifndef _SIZE_T_DECLARED
5122347Spsttypedef	__size_t	size_t;
5222347Spst#define	_SIZE_T_DECLARED
5322347Spst#endif
5422347Spst
5522347Spst#ifndef _SSIZE_T_DECLARED
5622347Spsttypedef	__ssize_t	ssize_t;
5722347Spst#define	_SSIZE_T_DECLARED
5822347Spst#endif
5922347Spst
6022347Spst#ifndef _UID_T_DECLARED
6122347Spsttypedef	__uid_t_	uid_t;
6222347Spst#define	_UID_T_DECLARED
6322347Spst#endif
6422347Spst
6522347Spst/*
6622347Spst * XXX missing type definitions for off_t, pid_t and useconds_t.
6722347Spst */
6822347Spst
6922347Spst#define	 STDIN_FILENO	0	/* standard input file descriptor */
7022347Spst#define	STDOUT_FILENO	1	/* standard output file descriptor */
7122347Spst#define	STDERR_FILENO	2	/* standard error file descriptor */
7222347Spst
7322347Spst#ifndef NULL
7422347Spst#define	NULL		0	/* null pointer constant */
7522347Spst#endif
7629964Sache
7729964Sache#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
7822347Spst#define	F_ULOCK		0	/* unlock locked section */
7922347Spst#define	F_LOCK		1	/* lock a section for exclusive use */
8022347Spst#define	F_TLOCK		2	/* test and lock a section for exclusive use */
8122347Spst#define	F_TEST		3	/* test a section for locks by other procs */
8222347Spst#endif
8322347Spst
8422347Spst/*
8522347Spst * POSIX options and option groups we unconditionally do or don't
8622347Spst * implement.  This list includes those options which are exclusively
8722347Spst * implemented (or not) in user mode.  Please keep this list in
8822347Spst * alphabetical order.
8922347Spst *
9022347Spst * Anything which is defined as zero below **must** have an
9122347Spst * implementation for the corresponding sysconf() which is able to
9222347Spst * determine conclusively whether or not the feature is supported.
9322347Spst * Anything which is defined as other than -1 below **must** have
9422347Spst * complete headers, types, and function declarations as specified by
9522347Spst * the POSIX standard; however, if the relevant sysconf() function
9622347Spst * returns -1, the functions may be stubbed out.
9722347Spst */
9822347Spst#define	_POSIX_BARRIERS			-1
9922347Spst#define	_POSIX_READER_WRITER_LOCKS	200112L
10022347Spst#define	_POSIX_REGEXP			1
10122347Spst#define	_POSIX_SHELL			1
10222347Spst#define	_POSIX_SPAWN			-1
10322347Spst#define	_POSIX_SPIN_LOCKS		-1
10422347Spst#define	_POSIX_THREAD_ATTR_STACKADDR	200112L
10522347Spst#define	_POSIX_THREAD_ATTR_STACKSIZE	200112L
10622347Spst#define	_POSIX_THREAD_CPUTIME		-1
10722347Spst#define	_POSIX_THREAD_PRIO_INHERIT	200112L
10822347Spst#define	_POSIX_THREAD_PRIO_PROTECT	200112L
10922347Spst#define	_POSIX_THREAD_PRIORITY_SCHEDULING 200112L
11022347Spst#define	_POSIX_THREAD_PROCESS_SHARED	-1
11122347Spst#define	_POSIX_THREAD_SAFE_FUNCTIONS	-1
11222347Spst#define	_POSIX_THREAD_SPORADIC_SERVER	-1
11322347Spst#define	_POSIX_THREADS			200112L
11422347Spst#define	_POSIX_TRACE			-1
11522347Spst#define	_POSIX_TRACE_EVENT_FILTER	-1
11622347Spst#define	_POSIX_TRACE_INHERIT		-1
11722347Spst#define	_POSIX_TRACE_LOG		-1
11822347Spst#define	_POSIX2_C_BIND			200112L	/* mandatory */
11922347Spst#define	_POSIX2_C_DEV			-1 /* need c99 utility */
12022347Spst#define	_POSIX2_CHAR_TERM		1
12122347Spst#define	_POSIX2_FORT_DEV		-1 /* need fort77 utility */
12222347Spst#define	_POSIX2_FORT_RUN		200112L
12322347Spst#define	_POSIX2_LOCALEDEF		-1
12422347Spst#define	_POSIX2_PBS			-1
12522347Spst#define	_POSIX2_PBS_ACCOUNTING		-1
12622347Spst#define	_POSIX2_PBS_CHECKPOINT		-1
12722347Spst#define	_POSIX2_PBS_LOCATE		-1
12822347Spst#define	_POSIX2_PBS_MESSAGE		-1
12922347Spst#define	_POSIX2_PBS_TRACK		-1
13022347Spst#define	_POSIX2_SW_DEV			-1 /* XXX ??? */
13122347Spst#define	_POSIX2_UPE			200112L
13222347Spst#define	_V6_ILP32_OFF32			-1
13322347Spst#define	_V6_ILP32_OFFBIG		0
13422347Spst#define	_V6_LP64_OFF64			0
13522347Spst#define	_V6_LPBIG_OFFBIG		-1
13622347Spst
13722347Spst#if __XSI_VISIBLE
13822347Spst#define	_XOPEN_CRYPT			-1 /* XXX ??? */
13922347Spst#define	_XOPEN_ENH_I18N			-1 /* mandatory in XSI */
14022347Spst#define	_XOPEN_LEGACY			-1
14122347Spst#define	_XOPEN_REALTIME			-1
14222347Spst#define	_XOPEN_REALTIME_THREADS		-1
14322347Spst#define	_XOPEN_UNIX			-1
14422347Spst#endif
14522347Spst
14622347Spst/* Define the versions we target for compliance. */
14722347Spst#define	_POSIX_VERSION		200112L
14822347Spst#define	_POSIX2_VERSION		199212L
14922347Spst
15022347Spst/*
15122347Spst * POSIX-style system configuration variable accessors (for the
15222347Spst * sysconf function).  The kernel does not directly implement the
15322347Spst * sysconf() interface; rather, a C library stub translates references
15422347Spst * to sysconf() into calls to sysctl() using a giant switch statement.
15522347Spst * Those that are marked `user' are implemented entirely in the C
15622347Spst * library and never query the kernel.  pathconf() is implemented
15722347Spst * directly by the kernel so those are not defined here.
15822347Spst */
15922347Spst#define	_SC_ARG_MAX		 1
16022347Spst#define	_SC_CHILD_MAX		 2
16122347Spst#define	_SC_CLK_TCK		 3
16222347Spst#define	_SC_NGROUPS_MAX		 4
16322347Spst#define	_SC_OPEN_MAX		 5
16422347Spst#define	_SC_JOB_CONTROL		 6
16522347Spst#define	_SC_SAVED_IDS		 7
16622347Spst#define	_SC_VERSION		 8
16722347Spst#define	_SC_BC_BASE_MAX		 9 /* user */
16822347Spst#define	_SC_BC_DIM_MAX		10 /* user */
16922347Spst#define	_SC_BC_SCALE_MAX	11 /* user */
17022347Spst#define	_SC_BC_STRING_MAX	12 /* user */
17122347Spst#define	_SC_COLL_WEIGHTS_MAX	13 /* user */
17222347Spst#define	_SC_EXPR_NEST_MAX	14 /* user */
17322347Spst#define	_SC_LINE_MAX		15 /* user */
17422347Spst#define	_SC_RE_DUP_MAX		16 /* user */
17522347Spst#define	_SC_2_VERSION		17 /* user */
17622347Spst#define	_SC_2_C_BIND		18 /* user */
17722347Spst#define	_SC_2_C_DEV		19 /* user */
17822347Spst#define	_SC_2_CHAR_TERM		20 /* user */
17922347Spst#define	_SC_2_FORT_DEV		21 /* user */
18022347Spst#define	_SC_2_FORT_RUN		22 /* user */
18122347Spst#define	_SC_2_LOCALEDEF		23 /* user */
18222347Spst#define	_SC_2_SW_DEV		24 /* user */
18322347Spst#define	_SC_2_UPE		25 /* user */
18422347Spst#define	_SC_STREAM_MAX		26 /* user */
18522347Spst#define	_SC_TZNAME_MAX		27 /* user */
18622347Spst
18722347Spst#if __POSIX_VISIBLE >= 199309
18822347Spst#define	_SC_ASYNCHRONOUS_IO	28
18922347Spst#define	_SC_MAPPED_FILES	29
19022347Spst#define	_SC_MEMLOCK		30
19122347Spst#define	_SC_MEMLOCK_RANGE	31
19222347Spst#define	_SC_MEMORY_PROTECTION	32
19322347Spst#define	_SC_MESSAGE_PASSING	33
19422347Spst#define	_SC_PRIORITIZED_IO	34
19522347Spst#define	_SC_PRIORITY_SCHEDULING	35
19622347Spst#define	_SC_REALTIME_SIGNALS	36
19722347Spst#define	_SC_SEMAPHORES		37
19822347Spst#define	_SC_FSYNC		38
19922347Spst#define	_SC_SHARED_MEMORY_OBJECTS 39
20022347Spst#define	_SC_SYNCHRONIZED_IO	40
20122347Spst#define	_SC_TIMERS		41
20222347Spst#define	_SC_AIO_LISTIO_MAX	42
20322347Spst#define	_SC_AIO_MAX		43
20422347Spst#define	_SC_AIO_PRIO_DELTA_MAX	44
20522347Spst#define	_SC_DELAYTIMER_MAX	45
20622347Spst#define	_SC_MQ_OPEN_MAX		46
20722347Spst#define	_SC_PAGESIZE		47
20822347Spst#define	_SC_RTSIG_MAX		48
20922347Spst#define	_SC_SEM_NSEMS_MAX	49
21022347Spst#define	_SC_SEM_VALUE_MAX	50
21122347Spst#define	_SC_SIGQUEUE_MAX	51
21222347Spst#define	_SC_TIMER_MAX		52
21322347Spst#endif
21422347Spst
21522347Spst#if __POSIX_VISIBLE >= 200112
21622347Spst#define	_SC_2_PBS		59 /* user */
21722347Spst#define	_SC_2_PBS_ACCOUNTING	60 /* user */
21822347Spst#define	_SC_2_PBS_CHECKPOINT	61 /* user */
21922347Spst#define	_SC_2_PBS_LOCATE	62 /* user */
22022347Spst#define	_SC_2_PBS_MESSAGE	63 /* user */
22122347Spst#define	_SC_2_PBS_TRACK		64 /* user */
22222347Spst#define	_SC_ADVISORY_INFO	65
22322347Spst#define	_SC_BARRIERS		66 /* user */
22422347Spst#define	_SC_CLOCK_SELECTION	67
22522347Spst#define	_SC_CPUTIME		68
22622347Spst#define	_SC_FILE_LOCKING	69
22722347Spst#define	_SC_GETGR_R_SIZE_MAX	70 /* user */
22822347Spst#define	_SC_GETPW_R_SIZE_MAX	71 /* user */
22922347Spst#define	_SC_HOST_NAME_MAX	72
23022347Spst#define	_SC_LOGIN_NAME_MAX	73
23122347Spst#define	_SC_MONOTONIC_CLOCK	74
23222347Spst#define	_SC_MQ_PRIO_MAX		75
23322347Spst#define	_SC_READER_WRITER_LOCKS	76 /* user */
23422347Spst#define	_SC_REGEXP		77 /* user */
23522347Spst#define	_SC_SHELL		78 /* user */
23622347Spst#define	_SC_SPAWN		79 /* user */
23722347Spst#define	_SC_SPIN_LOCKS		80 /* user */
23822347Spst#define	_SC_SPORADIC_SERVER	81
23922347Spst#define	_SC_THREAD_ATTR_STACKADDR 82 /* user */
24022347Spst#define	_SC_THREAD_ATTR_STACKSIZE 83 /* user */
24122347Spst#define	_SC_THREAD_CPUTIME	84 /* user */
24222347Spst#define	_SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
24322347Spst#define	_SC_THREAD_KEYS_MAX	86 /* user */
24422347Spst#define	_SC_THREAD_PRIO_INHERIT	87 /* user */
24522347Spst#define	_SC_THREAD_PRIO_PROTECT	88 /* user */
24622347Spst#define	_SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
24722347Spst#define	_SC_THREAD_PROCESS_SHARED 90 /* user */
24822347Spst#define	_SC_THREAD_SAFE_FUNCTIONS 91 /* user */
24922347Spst#define	_SC_THREAD_SPORADIC_SERVER 92 /* user */
25022347Spst#define	_SC_THREAD_STACK_MIN	93 /* user */
25122347Spst#define	_SC_THREAD_THREADS_MAX	94 /* user */
25222347Spst#define	_SC_TIMEOUTS		95 /* user */
25322347Spst#define	_SC_THREADS		96 /* user */
25422347Spst#define	_SC_TRACE		97 /* user */
25522347Spst#define	_SC_TRACE_EVENT_FILTER	98 /* user */
25622347Spst#define	_SC_TRACE_INHERIT	99 /* user */
25722347Spst#define	_SC_TRACE_LOG		100 /* user */
25822347Spst#define	_SC_TTY_NAME_MAX	101 /* user */
25922347Spst#define	_SC_TYPED_MEMORY_OBJECTS 102
26022347Spst#define	_SC_V6_ILP32_OFF32	103 /* user */
26122347Spst#define	_SC_V6_ILP32_OFFBIG	104 /* user */
26222347Spst#define	_SC_V6_LP64_OFF64	105 /* user */
26322347Spst#define	_SC_V6_LPBIG_OFFBIG	106 /* user */
26422347Spst#endif
26522347Spst
26622347Spst#if __XSI_VISIBLE
26722347Spst#define	_SC_ATEXIT_MAX		107 /* user */
26822347Spst#define	_SC_IOV_MAX		56
26922347Spst#define	_SC_PAGE_SIZE		_SC_PAGESIZE
27022347Spst#define	_SC_XOPEN_CRYPT		108 /* user */
27122347Spst#define	_SC_XOPEN_ENH_I18N	109 /* user */
27222347Spst#define	_SC_XOPEN_LEGACY	110 /* user */
27322347Spst#define	_SC_XOPEN_REALTIME	111
27422347Spst#define	_SC_XOPEN_REALTIME_THREADS 112
27522347Spst#define	_SC_XOPEN_SHM		113
27622347Spst#define	_SC_XOPEN_STREAMS	114
27722347Spst#define	_SC_XOPEN_UNIX		115
27822347Spst#define	_SC_XOPEN_VERSION	116
27922347Spst#define	_SC_XOPEN_XCU_VERSION	117 /* user */
28022347Spst#endif
28122347Spst
28222347Spst#if __BSD_VISIBLE
28322347Spst#define	_SC_NPROCESSORS_CONF	57
28422347Spst#define	_SC_NPROCESSORS_ONLN	58
28522347Spst#endif
28622347Spst
28722347Spst/* Keys for the confstr(3) function. */
28822347Spst#if __POSIX_VISIBLE >= 199209
28922347Spst#define	_CS_PATH		1	/* default value of PATH */
29022347Spst#endif
29122347Spst
29222347Spst#if __POSIX_VISIBLE >= 200112
29322347Spst#define	_CS_POSIX_V6_ILP32_OFF32_CFLAGS		2
29422347Spst#define	_CS_POSIX_V6_ILP32_OFF32_LDFLAGS	3
29522347Spst#define	_CS_POSIX_V6_ILP32_OFF32_LIBS		4
29622347Spst#define	_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	5
29722347Spst#define	_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	6
29822347Spst#define	_CS_POSIX_V6_ILP32_OFFBIG_LIBS		7
29922347Spst#define	_CS_POSIX_V6_LP64_OFF64_CFLAGS		8
30022347Spst#define	_CS_POSIX_V6_LP64_OFF64_LDFLAGS		9
30122347Spst#define	_CS_POSIX_V6_LP64_OFF64_LIBS		10
30222347Spst#define	_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	11
30322347Spst#define	_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	12
30422347Spst#define	_CS_POSIX_V6_LPBIG_OFFBIG_LIBS		13
30522347Spst#define	_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	14
30622347Spst#endif
30722347Spst
30822347Spst__BEGIN_DECLS
30922347Spst/* 1003.1-1990 */
31022347Spstvoid	 _exit(int) __dead2;
31122347Spstint	 access(const char *, int);
31222347Spstunsigned int	 alarm(unsigned int);
31322347Spstint	 chdir(const char *);
31422347Spstint	 chown(const char *, uid_t, gid_t);
31522347Spstint	 close(int);
31622347Spstint	 dup(int);
31722347Spstint	 dup2(int, int);
31822347Spstint	 eaccess(const char *, int);
31922347Spstint	 execl(const char *, const char *, ...);
32022347Spstint	 execle(const char *, const char *, ...);
32122347Spstint	 execlp(const char *, const char *, ...);
32222347Spstint	 execv(const char *, char * const *);
32322347Spstint	 execve(const char *, char * const *, char * const *);
32422347Spstint	 execvp(const char *, char * const *);
32522347Spstpid_t	 fork(void);
32622347Spstlong	 fpathconf(int, int);
32722347Spstchar	*getcwd(char *, size_t);
32822347Spstgid_t	 getegid(void);
32922347Spstuid_t	 geteuid(void);
33022347Spstgid_t	 getgid(void);
33122347Spstint	 getgroups(int, gid_t []);
33222347Spstchar	*getlogin(void);
33322347Spstpid_t	 getpgrp(void);
33422347Spstpid_t	 getpid(void);
33522347Spstpid_t	 getppid(void);
33622347Spstuid_t	 getuid(void);
33722347Spstint	 isatty(int);
33822347Spstint	 link(const char *, const char *);
33922347Spst#ifndef _LSEEK_DECLARED
34022347Spst#define	_LSEEK_DECLARED
34122347Spstoff_t	 lseek(int, off_t, int);
34222347Spst#endif
34322347Spstlong	 pathconf(const char *, int);
34422347Spstint	 pause(void);
34522347Spstint	 pipe(int *);
34622347Spstssize_t	 read(int, void *, size_t);
34722347Spstint	 rmdir(const char *);
34822347Spstint	 setgid(gid_t);
34922347Spstint	 setpgid(pid_t, pid_t);
35022347Spstvoid	 setproctitle(const char *_fmt, ...) __printf0like(1, 2);
35122347Spstpid_t	 setsid(void);
35222347Spstint	 setuid(uid_t);
35322347Spstunsigned int	 sleep(unsigned int);
35422347Spstlong	 sysconf(int);
35522347Spstpid_t	 tcgetpgrp(int);
35622347Spstint	 tcsetpgrp(int, pid_t);
35722347Spstchar	*ttyname(int);
35822347Spstint	 unlink(const char *);
35929964Sachessize_t	 write(int, const void *, size_t);
36022347Spst
36122347Spst/* 1003.2-1992 */
36222347Spst#if __POSIX_VISIBLE >= 199209
36322347Spstsize_t	 confstr(int, char *, size_t);
36422347Spstint	 getopt(int, char * const [], const char *);
36522347Spst
36622347Spstextern char *optarg;			/* getopt(3) external variables */
36722347Spstextern int optind, opterr, optopt;
36822347Spst#endif
36922347Spst
37022347Spst/* ISO/IEC 9945-1: 1996 */
37122347Spst#if __POSIX_VISIBLE >= 199506
37222347Spstint	 fsync(int);
37322347Spst
37422347Spst/*
37522347Spst * ftruncate() was in the POSIX Realtime Extension (it's used for shared
37622347Spst * memory), but truncate() was not.
37722347Spst */
37822347Spst#ifndef _FTRUNCATE_DECLARED
37922347Spst#define	_FTRUNCATE_DECLARED
38022347Spstint	 ftruncate(int, off_t);
38122347Spst#endif
38222347Spst
38322347Spstint	 getlogin_r(char *, int);
38422347Spst#endif
38522347Spst
38622347Spst/* 1003.1-2001 */
38722347Spst#if __POSIX_VISIBLE >= 200112
38822347Spstint	 fchown(int, uid_t, gid_t);
38922347Spstint	 gethostname(char *, int /* socklen_t */);
39022347Spstint	 setegid(gid_t);
39122347Spstint	 seteuid(uid_t);
39222347Spst#endif
39322347Spst
39422347Spst/*
39522347Spst * symlink() was originally in POSIX.1a, which was withdrawn after
39622347Spst * being overtaken by events (1003.1-2001).  It was in XPG4.2, and of
39722347Spst * course has been in BSD since 4.2.
39822347Spst */
39922347Spst#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE
40022347Spstint	 symlink(const char * __restrict, const char * __restrict);
40122347Spst#endif
40222347Spst
40322347Spst/* X/Open System Interfaces */
40422347Spst#if __XSI_VISIBLE
40522347Spstchar	*crypt(const char *, const char *);
40622347Spst/* char	*ctermid(char *); */		/* XXX ??? */
40722347Spstint	 encrypt(char *, int);
40822347Spstint	 fchdir(int);
40922347Spstint	 getpgid(pid_t _pid);
41022347Spstint	 getsid(pid_t _pid);
41122347Spstchar	*getwd(char *);			/* LEGACY: obsoleted by getcwd() */
41222347Spstint	 lchown(const char *, uid_t, gid_t);
41322347Spstint	 lockf(int, int, off_t);
41422347Spstint	 nice(int);
41522347Spstssize_t	 pread(int, void *, size_t, off_t);
41622347Spstssize_t	 pwrite(int, const void *, size_t, off_t);
41722347Spstint	 setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
41822347Spstint	 setregid(gid_t, gid_t);
41922347Spstint	 setreuid(uid_t, uid_t);
42022347Spst/* void	 swab(const void * __restrict, void * __restrict, ssize_t); */
42122347Spstvoid	 sync(void);
42222347Spstunsigned int	 ualarm(unsigned int, unsigned int);
42322347Spstint	 usleep(unsigned int);
42422347Spstpid_t	 vfork(void);
42522347Spst
42622347Spst/* See comment at ftruncate() above. */
42722347Spst#ifndef _TRUNCATE_DECLARED
42822347Spst#define	_TRUNCATE_DECLARED
42922347Spstint	 truncate(const char *, off_t);
43022347Spst#endif
43122347Spst#endif /* __XSI_VISIBLE */
43222347Spst
43322347Spst#if __BSD_VISIBLE
43422347Spststruct timeval;				/* select(2) */
43522347Spstint	 acct(const char *);
43622347Spstint	 async_daemon(void);
43722347Spstint	 brk(const void *);
43822347Spstint	 chroot(const char *);
43922347Spstconst char *
44022347Spst	 crypt_get_format(void);
44122347Spstint	 crypt_set_format(const char *);
44222347Spstint	 des_cipher(const char *, char *, long, int);
44322347Spstint	 des_setkey(const char *key);
44422347Spstvoid	 endusershell(void);
44522347Spstint	 exect(const char *, char * const *, char * const *);
44622347Spstchar	*fflagstostr(u_long);
44722347Spstint	 getdomainname(char *, int);
44822347Spstint	 getdtablesize(void);
44922347Spstint	 getgrouplist(const char *, gid_t, gid_t *, int *);
45022347Spstlong	 gethostid(void);
45122347Spstmode_t	 getmode(const void *, mode_t);
45222347Spstint	 getpagesize(void) __pure2;
45322347Spstchar	*getpass(const char *);
45422347Spstint	 getpeereid(int, uid_t *, gid_t *);
45522347Spstint	 getresgid(gid_t *, gid_t *, gid_t *);
45622347Spstint	 getresuid(uid_t *, uid_t *, uid_t *);
45722347Spstchar	*getusershell(void);
45822347Spstint	 initgroups(const char *, gid_t);
45922347Spstint	 iruserok(unsigned long, int, const char *, const char *);
46022347Spstint	 iruserok_sa(const void *, int, int, const char *, const char *);
46129964Sacheint	 issetugid(void);
46229964Sachechar	*mkdtemp(char *);
46329964Sacheint	 mknod(const char *, mode_t, dev_t);
46429964Sache#ifndef _MKSTEMP_DECLARED
46529964Sacheint	 mkstemp(char *);
46622347Spst#define	_MKSTEMP_DECLARED
46729964Sache#endif
46829964Sacheint	 mkstemps(char *, int);
46922347Spst#ifndef _MKTEMP_DECLARED
47022347Spstchar	*mktemp(char *);
47122347Spst#define	_MKTEMP_DECLARED
47222347Spst#endif
47322347Spstint	 nfsclnt(int, void *);
47422347Spstint	 nfssvc(int, void *);
47522347Spstint	 profil(char *, size_t, vm_offset_t, int);
47622347Spstint	 rcmd(char **, int, const char *, const char *, const char *, int *);
47722347Spstint	 rcmd_af(char **, int, const char *,
47822347Spst		const char *, const char *, int *, int);
47922347Spstint	 rcmdsh(char **, int, const char *,
48022347Spst		const char *, const char *, const char *);
48122347Spstchar	*re_comp(const char *);
48222347Spstint	 re_exec(const char *);
48322347Spstint	 readlink(const char *, char *, int);
48422347Spstint	 reboot(int);
48522347Spstint	 revoke(const char *);
48622347Spstpid_t	 rfork(int);
48722347Spstpid_t	 rfork_thread(int, void *, int (*)(void *), void *);
48822347Spstint	 rresvport(int *);
48922347Spstint	 rresvport_af(int *, int);
49022347Spstint	 ruserok(const char *, int, const char *, const char *);
49122347Spstvoid	*sbrk(intptr_t);
49222347Spst#if __BSD_VISIBLE
49322347Spst#ifndef _SELECT_DECLARED
49422347Spst#define	_SELECT_DECLARED
49522347Spstint	 select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
49622347Spst#endif
49722347Spst#endif
49822347Spstint	 setdomainname(const char *, int);
49922347Spstint	 setgroups(int, const gid_t *);
50022347Spstvoid	 sethostid(long);
50122347Spstint	 sethostname(const char *, int);
50222347Spst#ifndef _SETKEY_DECLARED
50322347Spstint	 setkey(const char *);
50422347Spst#define	_SETKEY_DECLARED
50522347Spst#endif
50622347Spstint	 setlogin(const char *);
50722347Spstvoid	*setmode(const char *);
50822347Spstint	 setresgid(gid_t, gid_t, gid_t);
50922347Spstint	 setresuid(uid_t, uid_t, uid_t);
51022347Spstint	 setrgid(gid_t);
51122347Spstint	 setruid(uid_t);
51222347Spstvoid	 setusershell(void);
51322347Spstint	 strtofflags(char **, u_long *, u_long *);
51422347Spstint	 swapon(const char *);
51522347Spstint	 syscall(int, ...);
51622347Spstoff_t	 __syscall(quad_t, ...);
51722347Spstint	 ttyslot(void);
51822347Spstint	 undelete(const char *);
51922347Spstint	 unwhiteout(const char *);
52022347Spstvoid	*valloc(size_t);			/* obsoleted by malloc() */
52122347Spst
52222347Spstextern char *suboptarg;			/* getsubopt(3) external variable */
52322347Spst#ifndef _GETSUBOPT_DECLARED
52422347Spstint	 getsubopt(char **, char * const *, char **);
52522347Spst#define	_GETSUBOPT_DECLARED
52622347Spst#endif
52722347Spstextern int optreset;			/* getopt(3) external variable */
52822347Spst#endif /* __BSD_VISIBLE */
52922347Spst__END_DECLS
53029964Sache
53122347Spst#endif /* !_UNISTD_H_ */
53222347Spst