unistd.h revision 1.63 1 /* $NetBSD: unistd.h,v 1.63 1998/07/27 09:58:49 mycroft Exp $ */
2
3 /*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 /*
40 * Copyright (c) 1991, 1993, 1994
41 * The Regents of the University of California. All rights reserved.
42 *
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 * 3. All advertising materials mentioning features or use of this software
52 * must display the following acknowledgement:
53 * This product includes software developed by the University of
54 * California, Berkeley and its contributors.
55 * 4. Neither the name of the University nor the names of its contributors
56 * may be used to endorse or promote products derived from this software
57 * without specific prior written permission.
58 *
59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
70 *
71 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
72 */
73
74 #ifndef _UNISTD_H_
75 #define _UNISTD_H_
76
77 #include <sys/cdefs.h>
78 #include <sys/types.h>
79 #include <sys/unistd.h>
80
81 #include <sys/featuretest.h>
82
83
84 /*
85 * IEEE Std 1003.1-90
86 */
87 #define STDIN_FILENO 0 /* standard input file descriptor */
88 #define STDOUT_FILENO 1 /* standard output file descriptor */
89 #define STDERR_FILENO 2 /* standard error file descriptor */
90
91 #ifndef NULL
92 #define NULL 0 /* null pointer constant */
93 #endif
94
95 __BEGIN_DECLS
96 __dead void _exit __P((int)) __attribute__((noreturn));
97 int access __P((const char *, int));
98 unsigned int alarm __P((unsigned int));
99 int chdir __P((const char *));
100 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
101 int chown __P((const char *, uid_t, gid_t)) __RENAME(__posix_chown);
102 #else
103 int chown __P((const char *, uid_t, gid_t));
104 #endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
105 int close __P((int));
106 size_t confstr __P((int, char *, size_t));
107 char *cuserid __P((char *)); /* obsolete */
108 int dup __P((int));
109 int dup2 __P((int, int));
110 int execl __P((const char *, const char *, ...));
111 int execle __P((const char *, const char *, ...));
112 int execlp __P((const char *, const char *, ...));
113 int execv __P((const char *, char * const *));
114 int execve __P((const char *, char * const *, char * const *));
115 int execvp __P((const char *, char * const *));
116 pid_t fork __P((void));
117 long fpathconf __P((int, int));
118 char *getcwd __P((char *, size_t));
119 gid_t getegid __P((void));
120 uid_t geteuid __P((void));
121 gid_t getgid __P((void));
122 int getgroups __P((int, gid_t []));
123 __aconst char *getlogin __P((void));
124 pid_t getpgrp __P((void));
125 pid_t getpid __P((void));
126 pid_t getppid __P((void));
127 uid_t getuid __P((void));
128 int isatty __P((int));
129 int link __P((const char *, const char *));
130 off_t lseek __P((int, off_t, int));
131 long pathconf __P((const char *, int));
132 int pause __P((void));
133 int pipe __P((int *));
134 ssize_t read __P((int, void *, size_t));
135 int rmdir __P((const char *));
136 int setgid __P((gid_t));
137 int setpgid __P((pid_t, pid_t));
138 pid_t setsid __P((void));
139 int setuid __P((uid_t));
140 unsigned int sleep __P((unsigned int));
141 long sysconf __P((int));
142 pid_t tcgetpgrp __P((int));
143 int tcsetpgrp __P((int, pid_t));
144 __aconst char *ttyname __P((int));
145 int unlink __P((const char *));
146 ssize_t write __P((int, const void *, size_t));
147
148
149 /*
150 * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
151 */
152 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
153 (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 4
154 int getopt __P((int, char * const *, const char *));
155
156 extern char *optarg; /* getopt(3) external variables */
157 extern int opterr;
158 extern int optind;
159 extern int optopt;
160 #endif
161
162
163 /*
164 * IEEE Std 1003.1b-93,
165 * also found in X/Open Portability Guide >= Issue 4 Verion 2
166 */
167 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
168 (_POSIX_C_SOURCE - 0) >= 199309L || \
169 (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
170 (_XOPEN_SOURCE - 0) >= 500
171 int ftruncate __P((int, off_t));
172 #endif
173
174
175 /*
176 * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
177 */
178 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
179 (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500
180 int fdatasync __P((int));
181 int fsync __P((int));
182 #endif
183
184
185 /*
186 * X/Open Portability Guide, all issues
187 */
188 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
189 int chroot __P((const char *));
190 int nice __P((int));
191 #endif
192
193
194 /*
195 * X/Open Portability Guide <= Issue 3
196 */
197 #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) <= 3
198 int rename __P((const char *, const char *)) __RENAME(__posix_rename);
199 #endif
200
201
202 /*
203 * X/Open Portability Guide >= Issue 4
204 */
205 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
206 (_XOPEN_SOURCE - 0) >= 4
207 __aconst char *crypt __P((const char *, const char *));
208 int encrypt __P((char *, int));
209 __aconst char *getpass __P((const char *));
210 pid_t getsid __P((pid_t));
211 #endif
212
213
214 /*
215 * X/Open Portability Guide >= Issue 4 Version 2
216 */
217 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
218 (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
219 (_XOPEN_SOURCE - 0) >= 500
220 #define F_ULOCK 0
221 #define F_LOCK 1
222 #define F_TLOCK 2
223 #define F_TEST 3
224
225 char *brk __P((const char *));
226 int fchdir __P((int));
227 #if defined(_XOPEN_SOURCE)
228 int fchown __P((int, uid_t, gid_t)) __RENAME(__posix_fchown);
229 #else
230 int fchown __P((int, uid_t, gid_t));
231 #endif
232 int getdtablesize __P((void));
233 long gethostid __P((void));
234 int gethostname __P((char *, size_t));
235 __pure int
236 getpagesize __P((void)); /* legacy */
237 #if defined(_XOPEN_SOURCE)
238 int lchown __P((const char *, uid_t, gid_t)) __RENAME(__posix_lchown);
239 #else
240 int lchown __P((const char *, uid_t, gid_t));
241 #endif
242 int lockf __P((int, int, off_t));
243 int readlink __P((const char *, char *, size_t));
244 char *sbrk __P((int));
245 /* XXX prototype wrong! */
246 int setpgrp __P((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */
247 int setregid __P((gid_t, gid_t));
248 int setreuid __P((uid_t, uid_t));
249 void swab __P((const void *, void *, size_t));
250 int symlink __P((const char *, const char *));
251 void sync __P((void));
252 int truncate __P((const char *, off_t));
253 useconds_t ualarm __P((useconds_t, useconds_t));
254 int usleep __P((useconds_t));
255 #ifdef __LIBC12_SOURCE__
256 pid_t vfork __P((void));
257 pid_t __vfork14 __P((void));
258 #else
259 pid_t vfork __P((void)) __RENAME(__vfork14);
260 #endif
261
262 #ifndef __AUDIT__
263 char *getwd __P((char *)); /* obsoleted by getcwd() */
264 #endif
265
266 /* FIXME: this should go to <sys/time.h>! */
267 #ifdef __STDC__
268 struct timeval; /* select(2) XXX */
269 #endif
270 int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
271 #endif /* (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || ... */
272
273
274 /*
275 * X/Open CAE Specification Issue 5 Version 2
276 */
277 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
278 (_XOPEN_SOURCE - 0) >= 500
279 ssize_t pread __P((int, void *, size_t, off_t));
280 ssize_t pwrite __P((int, const void *, size_t, off_t));
281 #endif
282
283
284 /*
285 * Implementation-defined extensions
286 */
287 #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
288 int acct __P((const char *));
289 int des_cipher __P((const char *, char *, long, int));
290 int des_setkey __P((const char *key));
291 void endusershell __P((void));
292 int exect __P((const char *, char * const *, char * const *));
293 int getdomainname __P((char *, size_t));
294 int getgrouplist __P((const char *, gid_t, gid_t *, int *));
295 mode_t getmode __P((const void *, mode_t));
296 int getsubopt __P((char **, char * const *, char **));
297 __aconst char *getusershell __P((void));
298 int initgroups __P((const char *, gid_t));
299 int iruserok __P((u_int32_t, int, const char *, const char *));
300 int nfssvc __P((int, void *));
301 int profil __P((char *, size_t, u_long, u_int));
302 void psignal __P((unsigned int, const char *));
303 int rcmd __P((char **, int, const char *,
304 const char *, const char *, int *));
305 int reboot __P((int, char *));
306 int revoke __P((const char *));
307 int rresvport __P((int *));
308 int ruserok __P((const char *, int, const char *, const char *));
309 int setdomainname __P((const char *, size_t));
310 int setegid __P((gid_t));
311 int seteuid __P((uid_t));
312 int setgroups __P((int, const gid_t *));
313 int sethostid __P((long));
314 int sethostname __P((const char *, size_t));
315 int setlogin __P((const char *));
316 void *setmode __P((const char *));
317 int setrgid __P((gid_t));
318 int setruid __P((uid_t));
319 void setusershell __P((void));
320 void strmode __P((mode_t, char *));
321 __aconst char *strsignal __P((int));
322 int swapctl __P((int, const void *, int));
323 int swapon __P((const char *)); /* obsoleted by swapctl() */
324 int syscall __P((int, ...));
325 quad_t __syscall __P((quad_t, ...));
326 int undelete __P((const char *));
327 int unwhiteout __P((const char *));
328
329 extern __const char *__const sys_siglist[];
330 extern int optreset; /* getopt(3) external variable */
331 extern char *suboptarg; /* getsubopt(3) external variable */
332 #endif
333
334 __END_DECLS
335
336 #endif /* !_UNISTD_H_ */
337