unistd.h revision 93032
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: head/include/unistd.h 93032 2002-03-23 17:24:55Z imp $
35 */
36
37#ifndef _UNISTD_H_
38#define	_UNISTD_H_
39
40#include <sys/cdefs.h>
41#include <sys/types.h>
42#include <sys/unistd.h>
43
44#define	 STDIN_FILENO	0	/* standard input file descriptor */
45#define	STDOUT_FILENO	1	/* standard output file descriptor */
46#define	STDERR_FILENO	2	/* standard error file descriptor */
47
48#ifndef NULL
49#define	NULL		0	/* null pointer constant */
50#endif
51
52#ifndef _POSIX_SOURCE
53#define	F_ULOCK		0	/* unlock locked section */
54#define	F_LOCK		1	/* lock a section for exclusive use */
55#define	F_TLOCK		2	/* test and lock a section for exclusive use */
56#define	F_TEST		3	/* test a section for locks by other procs */
57#endif
58
59__BEGIN_DECLS
60void	 _exit(int) __dead2;
61int	 access(const char *, int);
62unsigned int	 alarm(unsigned int);
63int	 chdir(const char *);
64int	 chown(const char *, uid_t, gid_t);
65int	 close(int);
66int	 dup(int);
67int	 dup2(int, int);
68int	 eaccess(const char *, int);
69int	 execl(const char *, const char *, ...);
70int	 execle(const char *, const char *, ...);
71int	 execlp(const char *, const char *, ...);
72int	 execv(const char *, char * const *);
73int	 execve(const char *, char * const *, char * const *);
74int	 execvp(const char *, char * const *);
75pid_t	 fork(void);
76long	 fpathconf(int, int);
77char	*getcwd(char *, size_t);
78gid_t	 getegid(void);
79uid_t	 geteuid(void);
80gid_t	 getgid(void);
81int	 getgroups(int, gid_t []);
82char	*getlogin(void);
83pid_t	 getpgrp(void);
84pid_t	 getpid(void);
85pid_t	 getppid(void);
86uid_t	 getuid(void);
87int	 isatty(int);
88int	 link(const char *, const char *);
89#ifndef _LSEEK_DECLARED
90#define	_LSEEK_DECLARED
91off_t	 lseek(int, off_t, int);
92#endif
93long	 pathconf(const char *, int);
94int	 pause(void);
95int	 pipe(int *);
96ssize_t	 read(int, void *, size_t);
97int	 rmdir(const char *);
98int	 setgid(gid_t);
99int	 setpgid(pid_t, pid_t);
100void	 setproctitle(const char *_fmt, ...) __printf0like(1, 2);
101pid_t	 setsid(void);
102int	 setuid(uid_t);
103unsigned int	 sleep(unsigned int);
104long	 sysconf(int);
105pid_t	 tcgetpgrp(int);
106int	 tcsetpgrp(int, pid_t);
107char	*ttyname(int);
108int	 unlink(const char *);
109ssize_t	 write(int, const void *, size_t);
110
111extern char *optarg;			/* getopt(3) external variables */
112extern int optind, opterr, optopt;
113int	 getopt(int, char * const [], const char *);
114
115#ifndef	_POSIX_SOURCE
116struct timeval;				/* select(2) */
117int	 acct(const char *);
118int	 async_daemon(void);
119int	 brk(const void *);
120int	 chroot(const char *);
121size_t	 confstr(int, char *, size_t);
122char	*crypt(const char *, const char *);
123__const char *
124	 crypt_get_format(void);
125int	 crypt_set_format(const char *);
126int	 des_cipher(const char *, char *, long, int);
127int	 des_setkey(const char *key);
128int	 encrypt(char *, int);
129void	 endusershell(void);
130int	 exect(const char *, char * const *, char * const *);
131int	 fchdir(int);
132int	 fchown(int, uid_t, gid_t);
133char	*fflagstostr(u_long);
134int	 fsync(int);
135#ifndef _FTRUNCATE_DECLARED
136#define	_FTRUNCATE_DECLARED
137int	 ftruncate(int, off_t);
138#endif
139int	 getdomainname(char *, int);
140int	 getdtablesize(void);
141int	 getgrouplist(const char *, gid_t, gid_t *, int *);
142long	 gethostid(void);
143int	 gethostname(char *, int);
144int	 getlogin_r(char *, int);
145mode_t	 getmode(const void *, mode_t);
146int	 getpagesize(void) __pure2;
147char	*getpass(const char *);
148int	 getpeereid(int, uid_t *, gid_t *);
149int	 getpgid(pid_t _pid);
150int	 getresgid(gid_t *, gid_t *, gid_t *);
151int	 getresuid(uid_t *, uid_t *, uid_t *);
152int	 getsid(pid_t _pid);
153char	*getusershell(void);
154char	*getwd(char *);			/* obsoleted by getcwd() */
155int	 initgroups(const char *, gid_t);
156int	 iruserok(unsigned long, int, const char *, const char *);
157int	 iruserok_sa(const void *, int, int, const char *, const char *);
158int	 issetugid(void);
159int	 lchown(const char *, uid_t, gid_t);
160int	 lockf(int, int, off_t);
161char	*mkdtemp(char *);
162int	 mknod(const char *, mode_t, dev_t);
163int	 mkstemp(char *);
164int	 mkstemps(char *, int);
165char	*mktemp(char *);
166int	 nfsclnt(int, void *);
167int	 nfssvc(int, void *);
168int	 nice(int);
169ssize_t	 pread(int, void *, size_t, off_t);
170int	 profil(char *, size_t, vm_offset_t, int);
171ssize_t	 pwrite(int, const void *, size_t, off_t);
172int	 rcmd(char **, int, const char *, const char *, const char *, int *);
173int	 rcmd_af(char **, int, const char *,
174		const char *, const char *, int *, int);
175int	 rcmdsh(char **, int, const char *,
176		const char *, const char *, const char *);
177char	*re_comp(const char *);
178int	 re_exec(const char *);
179int	 readlink(const char *, char *, int);
180int	 reboot(int);
181int	 revoke(const char *);
182pid_t	 rfork(int);
183pid_t	 rfork_thread(int, void *, int (*)(void *), void *);
184int	 rresvport(int *);
185int	 rresvport_af(int *, int);
186int	 ruserok(const char *, int, const char *, const char *);
187void	*sbrk(intptr_t);
188int	 select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
189int	 setdomainname(const char *, int);
190int	 setegid(gid_t);
191int	 seteuid(uid_t);
192int	 setgroups(int, const gid_t *);
193void	 sethostid(long);
194int	 sethostname(const char *, int);
195int	 setkey(const char *);
196int	 setlogin(const char *);
197void	*setmode(const char *);
198int	 setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
199int	 setregid(gid_t, gid_t);
200int	 setresgid(gid_t, gid_t, gid_t);
201int	 setresuid(uid_t, uid_t, uid_t);
202int	 setreuid(uid_t, uid_t);
203int	 setrgid(gid_t);
204int	 setruid(uid_t);
205void	 setusershell(void);
206int	 strtofflags(char **, u_long *, u_long *);
207int	 swapon(const char *);
208int	 symlink(const char *, const char *);
209void	 sync(void);
210int	 syscall(int, ...);
211off_t	 __syscall(quad_t, ...);
212#ifndef _TRUNCATE_DECLARED
213#define	_TRUNCATE_DECLARED
214int	 truncate(const char *, off_t);
215#endif
216int	 ttyslot(void);
217unsigned int	 ualarm(unsigned int, unsigned int);
218int	 undelete(const char *);
219int	 unwhiteout(const char *);
220int	 usleep(unsigned int);
221void	*valloc(size_t);			/* obsoleted by malloc() */
222pid_t	 vfork(void);
223
224extern char *suboptarg;			/* getsubopt(3) external variable */
225int	 getsubopt(char **, char * const *, char **);
226#endif /* !_POSIX_SOURCE */
227extern int optreset;			/* getopt(3) external variable */
228__END_DECLS
229
230#endif /* !_UNISTD_H_ */
231