unistd.h revision 93032
1235537Sgber/*-
2235537Sgber * Copyright (c) 1991, 1993, 1994
3235537Sgber *	The Regents of the University of California.  All rights reserved.
4235537Sgber *
5235537Sgber * Redistribution and use in source and binary forms, with or without
6235537Sgber * modification, are permitted provided that the following conditions
7235537Sgber * are met:
8235537Sgber * 1. Redistributions of source code must retain the above copyright
9235537Sgber *    notice, this list of conditions and the following disclaimer.
10235537Sgber * 2. Redistributions in binary form must reproduce the above copyright
11235537Sgber *    notice, this list of conditions and the following disclaimer in the
12235537Sgber *    documentation and/or other materials provided with the distribution.
13235537Sgber * 3. All advertising materials mentioning features or use of this software
14235537Sgber *    must display the following acknowledgement:
15235537Sgber *	This product includes software developed by the University of
16235537Sgber *	California, Berkeley and its contributors.
17235537Sgber * 4. Neither the name of the University nor the names of its contributors
18235537Sgber *    may be used to endorse or promote products derived from this software
19235537Sgber *    without specific prior written permission.
20235537Sgber *
21235537Sgber * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22235537Sgber * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23235537Sgber * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24235537Sgber * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25235537Sgber * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26235537Sgber * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27235537Sgber * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28235537Sgber * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29235537Sgber * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30235537Sgber * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31235537Sgber * SUCH DAMAGE.
32235537Sgber *
33235537Sgber *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
34235537Sgber * $FreeBSD: head/include/unistd.h 93032 2002-03-23 17:24:55Z imp $
35235537Sgber */
36235537Sgber
37235537Sgber#ifndef _UNISTD_H_
38235537Sgber#define	_UNISTD_H_
39235537Sgber
40235537Sgber#include <sys/cdefs.h>
41235537Sgber#include <sys/types.h>
42235537Sgber#include <sys/unistd.h>
43235537Sgber
44235537Sgber#define	 STDIN_FILENO	0	/* standard input file descriptor */
45235537Sgber#define	STDOUT_FILENO	1	/* standard output file descriptor */
46235537Sgber#define	STDERR_FILENO	2	/* standard error file descriptor */
47235537Sgber
48235537Sgber#ifndef NULL
49235537Sgber#define	NULL		0	/* null pointer constant */
50235537Sgber#endif
51235537Sgber
52235537Sgber#ifndef _POSIX_SOURCE
53235537Sgber#define	F_ULOCK		0	/* unlock locked section */
54235537Sgber#define	F_LOCK		1	/* lock a section for exclusive use */
55235537Sgber#define	F_TLOCK		2	/* test and lock a section for exclusive use */
56235537Sgber#define	F_TEST		3	/* test a section for locks by other procs */
57235537Sgber#endif
58235537Sgber
59235537Sgber__BEGIN_DECLS
60235537Sgbervoid	 _exit(int) __dead2;
61235537Sgberint	 access(const char *, int);
62235537Sgberunsigned int	 alarm(unsigned int);
63235537Sgberint	 chdir(const char *);
64235537Sgberint	 chown(const char *, uid_t, gid_t);
65235537Sgberint	 close(int);
66235537Sgberint	 dup(int);
67235537Sgberint	 dup2(int, int);
68235537Sgberint	 eaccess(const char *, int);
69235537Sgberint	 execl(const char *, const char *, ...);
70235537Sgberint	 execle(const char *, const char *, ...);
71235537Sgberint	 execlp(const char *, const char *, ...);
72235537Sgberint	 execv(const char *, char * const *);
73235537Sgberint	 execve(const char *, char * const *, char * const *);
74235537Sgberint	 execvp(const char *, char * const *);
75235537Sgberpid_t	 fork(void);
76235537Sgberlong	 fpathconf(int, int);
77235537Sgberchar	*getcwd(char *, size_t);
78235537Sgbergid_t	 getegid(void);
79235537Sgberuid_t	 geteuid(void);
80235537Sgbergid_t	 getgid(void);
81235537Sgberint	 getgroups(int, gid_t []);
82235537Sgberchar	*getlogin(void);
83235537Sgberpid_t	 getpgrp(void);
84235537Sgberpid_t	 getpid(void);
85235537Sgberpid_t	 getppid(void);
86235537Sgberuid_t	 getuid(void);
87235537Sgberint	 isatty(int);
88235537Sgberint	 link(const char *, const char *);
89235537Sgber#ifndef _LSEEK_DECLARED
90235537Sgber#define	_LSEEK_DECLARED
91235537Sgberoff_t	 lseek(int, off_t, int);
92235537Sgber#endif
93235537Sgberlong	 pathconf(const char *, int);
94235537Sgberint	 pause(void);
95235537Sgberint	 pipe(int *);
96235537Sgberssize_t	 read(int, void *, size_t);
97235537Sgberint	 rmdir(const char *);
98247613Smarcelint	 setgid(gid_t);
99235537Sgberint	 setpgid(pid_t, pid_t);
100235537Sgbervoid	 setproctitle(const char *_fmt, ...) __printf0like(1, 2);
101235537Sgberpid_t	 setsid(void);
102235537Sgberint	 setuid(uid_t);
103235537Sgberunsigned int	 sleep(unsigned int);
104235537Sgberlong	 sysconf(int);
105235537Sgberpid_t	 tcgetpgrp(int);
106235537Sgberint	 tcsetpgrp(int, pid_t);
107235537Sgberchar	*ttyname(int);
108235537Sgberint	 unlink(const char *);
109235537Sgberssize_t	 write(int, const void *, size_t);
110235537Sgber
111235537Sgberextern char *optarg;			/* getopt(3) external variables */
112235537Sgberextern int optind, opterr, optopt;
113235537Sgberint	 getopt(int, char * const [], const char *);
114235537Sgber
115235537Sgber#ifndef	_POSIX_SOURCE
116235537Sgberstruct timeval;				/* select(2) */
117235537Sgberint	 acct(const char *);
118235537Sgberint	 async_daemon(void);
119235537Sgberint	 brk(const void *);
120235537Sgberint	 chroot(const char *);
121235537Sgbersize_t	 confstr(int, char *, size_t);
122235537Sgberchar	*crypt(const char *, const char *);
123235537Sgber__const char *
124235537Sgber	 crypt_get_format(void);
125235537Sgberint	 crypt_set_format(const char *);
126235537Sgberint	 des_cipher(const char *, char *, long, int);
127247611Smarcelint	 des_setkey(const char *key);
128247611Smarcelint	 encrypt(char *, int);
129247611Smarcelvoid	 endusershell(void);
130247611Smarcelint	 exect(const char *, char * const *, char * const *);
131247611Smarcelint	 fchdir(int);
132247611Smarcelint	 fchown(int, uid_t, gid_t);
133247611Smarcelchar	*fflagstostr(u_long);
134247611Smarcelint	 fsync(int);
135247611Smarcel#ifndef _FTRUNCATE_DECLARED
136247611Smarcel#define	_FTRUNCATE_DECLARED
137247611Smarcelint	 ftruncate(int, off_t);
138247611Smarcel#endif
139247611Smarcelint	 getdomainname(char *, int);
140247611Smarcelint	 getdtablesize(void);
141247611Smarcelint	 getgrouplist(const char *, gid_t, gid_t *, int *);
142247611Smarcellong	 gethostid(void);
143247611Smarcelint	 gethostname(char *, int);
144247611Smarcelint	 getlogin_r(char *, int);
145247611Smarcelmode_t	 getmode(const void *, mode_t);
146247611Smarcelint	 getpagesize(void) __pure2;
147247611Smarcelchar	*getpass(const char *);
148235537Sgberint	 getpeereid(int, uid_t *, gid_t *);
149235537Sgberint	 getpgid(pid_t _pid);
150235537Sgberint	 getresgid(gid_t *, gid_t *, gid_t *);
151235537Sgberint	 getresuid(uid_t *, uid_t *, uid_t *);
152235537Sgberint	 getsid(pid_t _pid);
153235537Sgberchar	*getusershell(void);
154235537Sgberchar	*getwd(char *);			/* obsoleted by getcwd() */
155235537Sgberint	 initgroups(const char *, gid_t);
156235537Sgberint	 iruserok(unsigned long, int, const char *, const char *);
157235537Sgberint	 iruserok_sa(const void *, int, int, const char *, const char *);
158235537Sgberint	 issetugid(void);
159235537Sgberint	 lchown(const char *, uid_t, gid_t);
160235537Sgberint	 lockf(int, int, off_t);
161247611Smarcelchar	*mkdtemp(char *);
162235537Sgberint	 mknod(const char *, mode_t, dev_t);
163235537Sgberint	 mkstemp(char *);
164235537Sgberint	 mkstemps(char *, int);
165235537Sgberchar	*mktemp(char *);
166235537Sgberint	 nfsclnt(int, void *);
167235537Sgberint	 nfssvc(int, void *);
168235537Sgberint	 nice(int);
169235537Sgberssize_t	 pread(int, void *, size_t, off_t);
170235537Sgberint	 profil(char *, size_t, vm_offset_t, int);
171235537Sgberssize_t	 pwrite(int, const void *, size_t, off_t);
172235537Sgberint	 rcmd(char **, int, const char *, const char *, const char *, int *);
173235537Sgberint	 rcmd_af(char **, int, const char *,
174235537Sgber		const char *, const char *, int *, int);
175235537Sgberint	 rcmdsh(char **, int, const char *,
176235537Sgber		const char *, const char *, const char *);
177235537Sgberchar	*re_comp(const char *);
178235537Sgberint	 re_exec(const char *);
179235537Sgberint	 readlink(const char *, char *, int);
180235537Sgberint	 reboot(int);
181235537Sgberint	 revoke(const char *);
182235537Sgberpid_t	 rfork(int);
183235537Sgberpid_t	 rfork_thread(int, void *, int (*)(void *), void *);
184235537Sgberint	 rresvport(int *);
185247611Smarcelint	 rresvport_af(int *, int);
186235537Sgberint	 ruserok(const char *, int, const char *, const char *);
187235537Sgbervoid	*sbrk(intptr_t);
188235537Sgberint	 select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
189235537Sgberint	 setdomainname(const char *, int);
190235537Sgberint	 setegid(gid_t);
191235537Sgberint	 seteuid(uid_t);
192235537Sgberint	 setgroups(int, const gid_t *);
193235537Sgbervoid	 sethostid(long);
194235537Sgberint	 sethostname(const char *, int);
195235537Sgberint	 setkey(const char *);
196235537Sgberint	 setlogin(const char *);
197235537Sgbervoid	*setmode(const char *);
198241157Sgberint	 setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
199235537Sgberint	 setregid(gid_t, gid_t);
200235537Sgberint	 setresgid(gid_t, gid_t, gid_t);
201235537Sgberint	 setresuid(uid_t, uid_t, uid_t);
202235537Sgberint	 setreuid(uid_t, uid_t);
203235537Sgberint	 setrgid(gid_t);
204235537Sgberint	 setruid(uid_t);
205235537Sgbervoid	 setusershell(void);
206235537Sgberint	 strtofflags(char **, u_long *, u_long *);
207235537Sgberint	 swapon(const char *);
208235537Sgberint	 symlink(const char *, const char *);
209235537Sgbervoid	 sync(void);
210235537Sgberint	 syscall(int, ...);
211235537Sgberoff_t	 __syscall(quad_t, ...);
212235537Sgber#ifndef _TRUNCATE_DECLARED
213235537Sgber#define	_TRUNCATE_DECLARED
214235537Sgberint	 truncate(const char *, off_t);
215235537Sgber#endif
216235537Sgberint	 ttyslot(void);
217235537Sgberunsigned int	 ualarm(unsigned int, unsigned int);
218235537Sgberint	 undelete(const char *);
219241157Sgberint	 unwhiteout(const char *);
220235537Sgberint	 usleep(unsigned int);
221235537Sgbervoid	*valloc(size_t);			/* obsoleted by malloc() */
222235537Sgberpid_t	 vfork(void);
223235537Sgber
224241157Sgberextern char *suboptarg;			/* getsubopt(3) external variable */
225235537Sgberint	 getsubopt(char **, char * const *, char **);
226235537Sgber#endif /* !_POSIX_SOURCE */
227235537Sgberextern int optreset;			/* getopt(3) external variable */
228235537Sgber__END_DECLS
229241157Sgber
230235537Sgber#endif /* !_UNISTD_H_ */
231235537Sgber