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