2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
33 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
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>
45 #ifndef _GID_T_DECLARED
46 typedef __gid_t gid_t;
47 #define _GID_T_DECLARED
50 #ifndef _SIZE_T_DECLARED
51 typedef __size_t size_t;
52 #define _SIZE_T_DECLARED
55 #ifndef _SSIZE_T_DECLARED
56 typedef __ssize_t ssize_t;
57 #define _SSIZE_T_DECLARED
60 #ifndef _UID_T_DECLARED
61 typedef __uid_t_ uid_t;
62 #define _UID_T_DECLARED
66 * XXX missing type definitions for off_t, pid_t and useconds_t.
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 */
74 #define NULL 0 /* null pointer constant */
77 #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
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 */
86 void _exit(int) __dead2;
87 int access(const char *, int);
88 unsigned int alarm(unsigned int);
89 int chdir(const char *);
90 int chown(const char *, uid_t, gid_t);
94 int eaccess(const char *, int);
95 int execl(const char *, const char *, ...);
96 int execle(const char *, const char *, ...);
97 int execlp(const char *, const char *, ...);
98 int execv(const char *, char * const *);
99 int execve(const char *, char * const *, char * const *);
100 int execvp(const char *, char * const *);
102 long fpathconf(int, int);
103 char *getcwd(char *, size_t);
107 int getgroups(int, gid_t []);
108 char *getlogin(void);
114 int link(const char *, const char *);
115 #ifndef _LSEEK_DECLARED
116 #define _LSEEK_DECLARED
117 off_t lseek(int, off_t, int);
119 long pathconf(const char *, int);
122 ssize_t read(int, void *, size_t);
123 int rmdir(const char *);
125 int setpgid(pid_t, pid_t);
126 void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
129 unsigned int sleep(unsigned int);
131 pid_t tcgetpgrp(int);
132 int tcsetpgrp(int, pid_t);
134 int unlink(const char *);
135 ssize_t write(int, const void *, size_t);
138 #if __POSIX_VISIBLE >= 199209
139 size_t confstr(int, char *, size_t);
140 int getopt(int, char * const [], const char *);
142 extern char *optarg; /* getopt(3) external variables */
143 extern int optind, opterr, optopt;
145 #define _CS_PATH 1 /* default value of PATH */
148 /* ISO/IEC 9945-1: 1996 */
149 #if __POSIX_VISIBLE >= 199506
153 * ftruncate() was in the POSIX Realtime Extension (it's used for shared
154 * memory), but truncate() was not.
156 #ifndef _FTRUNCATE_DECLARED
157 #define _FTRUNCATE_DECLARED
158 int ftruncate(int, off_t);
161 int getlogin_r(char *, int);
165 #if __POSIX_VISIBLE >= 200112
166 int fchown(int, uid_t, gid_t);
167 int gethostname(char *, int /* socklen_t */);
171 /* X/Open mistake copied by POSIX */
172 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
173 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
174 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
175 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
176 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
177 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
178 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
179 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
180 #define _CS_POSIX_V6_LP64_OFF64_LIBS 10
181 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
182 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
183 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
184 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
188 * symlink() was originally in POSIX.1a, which was withdrawn after
189 * being overtaken by events (1003.1-2001). It was in XPG4.2, and of
190 * course has been in BSD practically forever.
192 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE
193 int symlink(const char * __restrict, const char * __restrict);
196 /* X/Open System Interfaces */
198 char *crypt(const char *, const char *);
199 /* char *ctermid(char *); */ /* XXX ??? */
200 int encrypt(char *, int);
202 int getpgid(pid_t _pid);
203 int getsid(pid_t _pid);
204 char *getwd(char *); /* LEGACY: obsoleted by getcwd() */
205 int lchown(const char *, uid_t, gid_t);
206 int lockf(int, int, off_t);
208 ssize_t pread(int, void *, size_t, off_t);
209 ssize_t pwrite(int, const void *, size_t, off_t);
210 int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */
211 int setregid(gid_t, gid_t);
212 int setreuid(uid_t, uid_t);
213 /* void swab(const void * __restrict, void * __restrict, ssize_t); */
215 unsigned int ualarm(unsigned int, unsigned int);
216 int usleep(unsigned int);
219 /* See comment at ftruncate() above. */
220 #ifndef _TRUNCATE_DECLARED
221 #define _TRUNCATE_DECLARED
222 int truncate(const char *, off_t);
224 #endif /* __XSI_VISIBLE */
227 struct timeval; /* select(2) */
228 int acct(const char *);
229 int async_daemon(void);
230 int brk(const void *);
231 int chroot(const char *);
233 crypt_get_format(void);
234 int crypt_set_format(const char *);
235 int des_cipher(const char *, char *, long, int);
236 int des_setkey(const char *key);
237 void endusershell(void);
238 int exect(const char *, char * const *, char * const *);
239 char *fflagstostr(u_long);
240 int getdomainname(char *, int);
241 int getdtablesize(void);
242 int getgrouplist(const char *, gid_t, gid_t *, int *);
243 long gethostid(void);
244 mode_t getmode(const void *, mode_t);
245 int getpagesize(void) __pure2;
246 char *getpass(const char *);
247 int getpeereid(int, uid_t *, gid_t *);
248 int getresgid(gid_t *, gid_t *, gid_t *);
249 int getresuid(uid_t *, uid_t *, uid_t *);
250 char *getusershell(void);
251 int initgroups(const char *, gid_t);
252 int iruserok(unsigned long, int, const char *, const char *);
253 int iruserok_sa(const void *, int, int, const char *, const char *);
255 char *mkdtemp(char *);
256 int mknod(const char *, mode_t, dev_t);
258 int mkstemps(char *, int);
259 char *mktemp(char *);
260 int nfsclnt(int, void *);
261 int nfssvc(int, void *);
262 int profil(char *, size_t, vm_offset_t, int);
263 int rcmd(char **, int, const char *, const char *, const char *, int *);
264 int rcmd_af(char **, int, const char *,
265 const char *, const char *, int *, int);
266 int rcmdsh(char **, int, const char *,
267 const char *, const char *, const char *);
268 char *re_comp(const char *);
269 int re_exec(const char *);
270 int readlink(const char *, char *, int);
272 int revoke(const char *);
274 pid_t rfork_thread(int, void *, int (*)(void *), void *);
275 int rresvport(int *);
276 int rresvport_af(int *, int);
277 int ruserok(const char *, int, const char *, const char *);
278 void *sbrk(intptr_t);
279 int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
280 int setdomainname(const char *, int);
281 int setgroups(int, const gid_t *);
282 void sethostid(long);
283 int sethostname(const char *, int);
284 int setkey(const char *);
285 int setlogin(const char *);
286 void *setmode(const char *);
287 int setresgid(gid_t, gid_t, gid_t);
288 int setresuid(uid_t, uid_t, uid_t);
291 void setusershell(void);
292 int strtofflags(char **, u_long *, u_long *);
293 int swapon(const char *);
294 int syscall(int, ...);
295 off_t __syscall(quad_t, ...);
297 int undelete(const char *);
298 int unwhiteout(const char *);
299 void *valloc(size_t); /* obsoleted by malloc() */
301 extern char *suboptarg; /* getsubopt(3) external variable */
302 int getsubopt(char **, char * const *, char **);
303 extern int optreset; /* getopt(3) external variable */
304 #endif /* __BSD_VISIBLE */
307 #endif /* !_UNISTD_H_ */