root / lab4 / .minix-src / include / unistd.h @ 14
History | View | Annotate | Download (14 KB)
1 |
/* $NetBSD: unistd.h,v 1.145 2015/03/24 07:44:52 wiz Exp $ */
|
---|---|
2 |
|
3 |
/*-
|
4 |
* Copyright (c) 1998, 1999, 2008 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 |
*
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
20 |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
21 |
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
22 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
23 |
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
* POSSIBILITY OF SUCH DAMAGE.
|
30 |
*/
|
31 |
|
32 |
/*
|
33 |
* Copyright (c) 1991, 1993, 1994
|
34 |
* The Regents of the University of California. All rights reserved.
|
35 |
*
|
36 |
* Redistribution and use in source and binary forms, with or without
|
37 |
* modification, are permitted provided that the following conditions
|
38 |
* are met:
|
39 |
* 1. Redistributions of source code must retain the above copyright
|
40 |
* notice, this list of conditions and the following disclaimer.
|
41 |
* 2. Redistributions in binary form must reproduce the above copyright
|
42 |
* notice, this list of conditions and the following disclaimer in the
|
43 |
* documentation and/or other materials provided with the distribution.
|
44 |
* 3. Neither the name of the University nor the names of its contributors
|
45 |
* may be used to endorse or promote products derived from this software
|
46 |
* without specific prior written permission.
|
47 |
*
|
48 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
49 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
50 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
51 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
52 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
53 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
54 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
55 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
56 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
57 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
58 |
* SUCH DAMAGE.
|
59 |
*
|
60 |
* @(#)unistd.h 8.12 (Berkeley) 4/27/95
|
61 |
*/
|
62 |
|
63 |
#ifndef _UNISTD_H_
|
64 |
#define _UNISTD_H_
|
65 |
|
66 |
#include <machine/ansi.h> |
67 |
#include <machine/int_types.h> |
68 |
#include <sys/cdefs.h> |
69 |
#include <sys/featuretest.h> |
70 |
#include <sys/types.h> |
71 |
#include <sys/unistd.h> |
72 |
|
73 |
#if _FORTIFY_SOURCE > 0 |
74 |
#include <ssp/unistd.h> |
75 |
#endif
|
76 |
|
77 |
/*
|
78 |
* IEEE Std 1003.1-90
|
79 |
*/
|
80 |
#define STDIN_FILENO 0 /* standard input file descriptor */ |
81 |
#define STDOUT_FILENO 1 /* standard output file descriptor */ |
82 |
#define STDERR_FILENO 2 /* standard error file descriptor */ |
83 |
|
84 |
#include <sys/null.h> |
85 |
|
86 |
__BEGIN_DECLS |
87 |
__dead void _exit(int); |
88 |
int access(const char *, int); |
89 |
unsigned int alarm(unsigned int); |
90 |
int chdir(const char *); |
91 |
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
92 |
int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown); |
93 |
#else
|
94 |
int chown(const char *, uid_t, gid_t); |
95 |
#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */ |
96 |
int close(int); |
97 |
size_t confstr(int, char *, size_t); |
98 |
#ifndef __CUSERID_DECLARED
|
99 |
#define __CUSERID_DECLARED
|
100 |
/* also declared in stdio.h */
|
101 |
char *cuserid(char *); /* obsolete */ |
102 |
#endif /* __CUSERID_DECLARED */ |
103 |
int dup(int); |
104 |
int dup2(int, int); |
105 |
int execl(const char *, const char *, ...); |
106 |
int execle(const char *, const char *, ...); |
107 |
int execlp(const char *, const char *, ...); |
108 |
int execv(const char *, char * const *); |
109 |
int execve(const char *, char * const *, char * const *); |
110 |
int execvp(const char *, char * const *); |
111 |
pid_t fork(void);
|
112 |
long fpathconf(int, int); |
113 |
#if __SSP_FORTIFY_LEVEL == 0 |
114 |
char *getcwd(char *, size_t); |
115 |
#endif
|
116 |
gid_t getegid(void);
|
117 |
uid_t geteuid(void);
|
118 |
gid_t getgid(void);
|
119 |
int getgroups(int, gid_t []); |
120 |
__aconst char *getlogin(void); |
121 |
int getlogin_r(char *, size_t); |
122 |
pid_t getpgrp(void);
|
123 |
pid_t getpid(void);
|
124 |
pid_t getppid(void);
|
125 |
uid_t getuid(void);
|
126 |
int isatty(int); |
127 |
int link(const char *, const char *); |
128 |
long pathconf(const char *, int); |
129 |
int pause(void); |
130 |
int pipe(int *); |
131 |
#if __SSP_FORTIFY_LEVEL == 0 |
132 |
ssize_t read(int, void *, size_t); |
133 |
#endif
|
134 |
int rmdir(const char *); |
135 |
int setgid(gid_t);
|
136 |
int setpgid(pid_t, pid_t);
|
137 |
pid_t setsid(void);
|
138 |
int setuid(uid_t);
|
139 |
unsigned int sleep(unsigned int); |
140 |
long sysconf(int); |
141 |
pid_t tcgetpgrp(int);
|
142 |
int tcsetpgrp(int, pid_t); |
143 |
__aconst char *ttyname(int); |
144 |
int unlink(const char *); |
145 |
ssize_t write(int, const void *, size_t); |
146 |
|
147 |
|
148 |
/*
|
149 |
* IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
|
150 |
*/
|
151 |
#if (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) || \ |
152 |
defined(_NETBSD_SOURCE) |
153 |
int getopt(int, char * const [], const char *); |
154 |
|
155 |
extern char *optarg; /* getopt(3) external variables */ |
156 |
extern int opterr; |
157 |
extern int optind; |
158 |
extern int optopt; |
159 |
#endif
|
160 |
|
161 |
/*
|
162 |
* The Open Group Base Specifications, Issue 5; IEEE Std 1003.1-2001 (POSIX)
|
163 |
*/
|
164 |
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \ |
165 |
defined(_NETBSD_SOURCE) |
166 |
#if __SSP_FORTIFY_LEVEL == 0 |
167 |
ssize_t readlink(const char * __restrict, char * __restrict, size_t); |
168 |
#endif
|
169 |
#endif
|
170 |
|
171 |
/*
|
172 |
* The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
|
173 |
*/
|
174 |
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \ |
175 |
defined(_NETBSD_SOURCE) |
176 |
#if !defined(__minix)
|
177 |
int posix_fallocate(int, off_t, off_t); |
178 |
#endif /* !defined(__minix) */ |
179 |
int setegid(gid_t);
|
180 |
int seteuid(uid_t);
|
181 |
#endif
|
182 |
|
183 |
/*
|
184 |
* The following three syscalls are also defined in <sys/types.h>
|
185 |
* We protect them against double declarations.
|
186 |
*/
|
187 |
#ifndef __OFF_T_SYSCALLS_DECLARED
|
188 |
#define __OFF_T_SYSCALLS_DECLARED
|
189 |
off_t lseek(int, off_t, int); |
190 |
int truncate(const char *, off_t); |
191 |
/*
|
192 |
* IEEE Std 1003.1b-93,
|
193 |
* also found in X/Open Portability Guide >= Issue 4 Verion 2
|
194 |
*/
|
195 |
#if (_POSIX_C_SOURCE - 0) >= 199309L || \ |
196 |
(defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \ |
197 |
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) |
198 |
int ftruncate(int, off_t); |
199 |
#endif
|
200 |
#endif /* __OFF_T_SYSCALLS_DECLARED */ |
201 |
|
202 |
|
203 |
/*
|
204 |
* IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
|
205 |
*/
|
206 |
#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \ |
207 |
defined(_NETBSD_SOURCE) |
208 |
#if !defined(__minix)
|
209 |
int fdatasync(int); |
210 |
#endif /* !defined(__minix) */ |
211 |
int fsync(int); |
212 |
#endif
|
213 |
|
214 |
|
215 |
/*
|
216 |
* IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
|
217 |
*/
|
218 |
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ |
219 |
defined(_REENTRANT) || defined(_NETBSD_SOURCE) |
220 |
int ttyname_r(int, char *, size_t); |
221 |
int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); |
222 |
#endif
|
223 |
|
224 |
/*
|
225 |
* X/Open Portability Guide, all issues
|
226 |
*/
|
227 |
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
228 |
int chroot(const char *); |
229 |
int nice(int); |
230 |
#endif
|
231 |
|
232 |
|
233 |
/*
|
234 |
* X/Open Portability Guide >= Issue 4
|
235 |
*/
|
236 |
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
237 |
__aconst char *crypt(const char *, const char *); |
238 |
int encrypt(char *, int); |
239 |
char *getpass(const char *); |
240 |
pid_t getsid(pid_t); |
241 |
#endif
|
242 |
|
243 |
|
244 |
/*
|
245 |
* X/Open Portability Guide >= Issue 4 Version 2
|
246 |
*/
|
247 |
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
248 |
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) |
249 |
#ifndef intptr_t
|
250 |
typedef __intptr_t intptr_t;
|
251 |
#define intptr_t __intptr_t
|
252 |
#endif
|
253 |
|
254 |
#define F_ULOCK 0 |
255 |
#define F_LOCK 1 |
256 |
#define F_TLOCK 2 |
257 |
#define F_TEST 3 |
258 |
|
259 |
int brk(void *); |
260 |
int fchdir(int); |
261 |
#if defined(_XOPEN_SOURCE)
|
262 |
int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown); |
263 |
#else
|
264 |
int fchown(int, uid_t, gid_t); |
265 |
#endif
|
266 |
int getdtablesize(void); |
267 |
long gethostid(void); |
268 |
int gethostname(char *, size_t); |
269 |
__pure int
|
270 |
getpagesize(void); /* legacy */ |
271 |
#if !defined(__minix)
|
272 |
pid_t getpgid(pid_t); |
273 |
#endif /* !defined(__minix) */ |
274 |
#if defined(_XOPEN_SOURCE)
|
275 |
int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown); |
276 |
#else
|
277 |
int lchown(const char *, uid_t, gid_t); |
278 |
#endif
|
279 |
int lockf(int, int, off_t); |
280 |
#if __SSP_FORTIFY_LEVEL == 0 |
281 |
ssize_t readlink(const char * __restrict, char * __restrict, size_t); |
282 |
#endif
|
283 |
void *sbrk(intptr_t);
|
284 |
/* XXX prototype wrong! */
|
285 |
int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ |
286 |
#if !defined(__minix)
|
287 |
int setregid(gid_t, gid_t);
|
288 |
int setreuid(uid_t, uid_t);
|
289 |
#endif /* !defined(__minix) */ |
290 |
void swab(const void * __restrict, void * __restrict, ssize_t); |
291 |
int symlink(const char *, const char *); |
292 |
void sync(void); |
293 |
useconds_t ualarm(useconds_t, useconds_t); |
294 |
int usleep(useconds_t);
|
295 |
#ifndef __LIBC12_SOURCE__
|
296 |
pid_t vfork(void) __RENAME(__vfork14) __returns_twice;
|
297 |
#endif
|
298 |
|
299 |
#ifndef __AUDIT__
|
300 |
char *getwd(char *); /* obsoleted by getcwd() */ |
301 |
#endif
|
302 |
#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */ |
303 |
|
304 |
|
305 |
/*
|
306 |
* X/Open CAE Specification Issue 5 Version 2
|
307 |
*/
|
308 |
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 500 || \ |
309 |
defined(_NETBSD_SOURCE) |
310 |
ssize_t pread(int, void *, size_t, off_t); |
311 |
ssize_t pwrite(int, const void *, size_t, off_t); |
312 |
#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */ |
313 |
|
314 |
/*
|
315 |
* X/Open Extended API set 2 (a.k.a. C063)
|
316 |
*/
|
317 |
#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \ |
318 |
defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE) |
319 |
int linkat(int, const char *, int, const char *, int); |
320 |
int renameat(int, const char *, int, const char *); |
321 |
int faccessat(int, const char *, int, int); |
322 |
int fchownat(int, const char *, uid_t, gid_t, int); |
323 |
ssize_t readlinkat(int, const char *, char *, size_t); |
324 |
int symlinkat(const char *, int, const char *); |
325 |
int unlinkat(int, const char *, int); |
326 |
#endif
|
327 |
#if defined(_INCOMPLETE_XOPEN_C063)
|
328 |
int fexecve(int, char * const *, char * const *); |
329 |
#endif
|
330 |
|
331 |
|
332 |
/*
|
333 |
* Implementation-defined extensions
|
334 |
*/
|
335 |
#if defined(_NETBSD_SOURCE)
|
336 |
#if !defined(__minix)
|
337 |
int acct(const char *); |
338 |
#endif /* !defined(__minix) */ |
339 |
int closefrom(int); |
340 |
int des_cipher(const char *, char *, long, int); |
341 |
int des_setkey(const char *); |
342 |
int dup3(int, int, int); |
343 |
void endusershell(void); |
344 |
int exect(const char *, char * const *, char * const *); |
345 |
int execvpe(const char *, char * const *, char * const *); |
346 |
int execlpe(const char *, const char *, ...); |
347 |
int fchroot(int); |
348 |
#if !defined(__minix)
|
349 |
int fdiscard(int, off_t, off_t); |
350 |
#endif /* !defined(__minix) */ |
351 |
int fsync_range(int, int, off_t, off_t); |
352 |
int getdomainname(char *, size_t); |
353 |
int getgrouplist(const char *, gid_t, gid_t *, int *); |
354 |
int getgroupmembership(const char *, gid_t, gid_t *, int, int *); |
355 |
mode_t getmode(const void *, mode_t); |
356 |
char *getpassfd(const char *, char *, size_t, int *, int, int); |
357 |
#define GETPASS_NEED_TTY 0x001 /* Fail if we cannot set tty */ |
358 |
#define GETPASS_FAIL_EOF 0x002 /* Fail on EOF */ |
359 |
#define GETPASS_BUF_LIMIT 0x004 /* beep on buffer limit */ |
360 |
#define GETPASS_NO_SIGNAL 0x008 /* don't make ttychars send signals */ |
361 |
#define GETPASS_NO_BEEP 0x010 /* don't beep */ |
362 |
#define GETPASS_ECHO 0x020 /* echo characters as they are typed */ |
363 |
#define GETPASS_ECHO_STAR 0x040 /* echo '*' for each character */ |
364 |
#define GETPASS_7BIT 0x080 /* mask the high bit each char */ |
365 |
#define GETPASS_FORCE_LOWER 0x100 /* lowercase each char */ |
366 |
#define GETPASS_FORCE_UPPER 0x200 /* uppercase each char */ |
367 |
#define GETPASS_ECHO_NL 0x400 /* echo a newline if successful */ |
368 |
|
369 |
char *getpass_r(const char *, char *, size_t); |
370 |
int getpeereid(int, uid_t *, gid_t *); |
371 |
int getsubopt(char **, char * const *, char **); |
372 |
__aconst char *getusershell(void); |
373 |
int initgroups(const char *, gid_t); |
374 |
int iruserok(uint32_t, int, const char *, const char *); |
375 |
int issetugid(void); |
376 |
int mkstemps(char *, int); |
377 |
int nfssvc(int, void *); |
378 |
int pipe2(int *, int); |
379 |
#if !defined(__minix)
|
380 |
int profil(char *, size_t, u_long, u_int); |
381 |
#endif /* !defined(__minix) */ |
382 |
#ifndef __PSIGNAL_DECLARED
|
383 |
#define __PSIGNAL_DECLARED
|
384 |
/* also in signal.h */
|
385 |
void psignal(int, const char *); |
386 |
#endif /* __PSIGNAL_DECLARED */ |
387 |
int rcmd(char **, int, const char *, const char *, const char *, int *); |
388 |
int reboot(int, char *); |
389 |
#if !defined(__minix)
|
390 |
int revoke(const char *); |
391 |
#endif /* !defined(__minix) */ |
392 |
int rresvport(int *); |
393 |
int ruserok(const char *, int, const char *, const char *); |
394 |
int setdomainname(const char *, size_t); |
395 |
int setgroups(int, const gid_t *); |
396 |
int sethostid(long); |
397 |
int sethostname(const char *, size_t); |
398 |
int setlogin(const char *); |
399 |
void *setmode(const char *); |
400 |
int setrgid(gid_t);
|
401 |
int setruid(uid_t);
|
402 |
void setusershell(void); |
403 |
void strmode(mode_t, char *); |
404 |
#ifndef __STRSIGNAL_DECLARED
|
405 |
#define __STRSIGNAL_DECLARED
|
406 |
/* backwards-compatibility; also in string.h */
|
407 |
__aconst char *strsignal(int); |
408 |
#endif /* __STRSIGNAL_DECLARED */ |
409 |
#if !defined(__minix)
|
410 |
int swapctl(int, void *, int); |
411 |
int swapon(const char *); /* obsoleted by swapctl() */ |
412 |
#endif /* !defined(__minix) */ |
413 |
int syscall(int, ...); |
414 |
quad_t __syscall(quad_t, ...); |
415 |
int undelete(const char *); |
416 |
|
417 |
#if 1 /*INET6*/ |
418 |
int rcmd_af(char **, int, const char *, |
419 |
const char *, const char *, int *, int); |
420 |
int rresvport_af(int *, int); |
421 |
int rresvport_af_addr(int *, int, void *); |
422 |
int iruserok_sa(const void *, int, int, const char *, const char *); |
423 |
#endif
|
424 |
|
425 |
#ifndef __SYS_SIGLIST_DECLARED
|
426 |
#define __SYS_SIGLIST_DECLARED
|
427 |
/* also in signal.h */
|
428 |
extern const char *const *sys_siglist __RENAME(__sys_siglist14); |
429 |
#endif /* __SYS_SIGLIST_DECLARED */ |
430 |
extern int optreset; /* getopt(3) external variable */ |
431 |
extern char *suboptarg; /* getsubopt(3) external variable */ |
432 |
#endif
|
433 |
|
434 |
__END_DECLS |
435 |
#endif /* !_UNISTD_H_ */ |