unistd.h revision 1.79
1/*	$NetBSD: unistd.h,v 1.79 1999/12/22 21:26:20 kleink Exp $	*/
2
3/*-
4 * Copyright (c) 1998, 1999 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 <machine/ansi.h>
78#include <sys/cdefs.h>
79#include <sys/featuretest.h>
80#include <sys/types.h>
81#include <sys/unistd.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#include <null.h>
92
93__BEGIN_DECLS
94__dead	 void _exit __P((int)) __attribute__((__noreturn__));
95int	 access __P((const char *, int));
96unsigned int alarm __P((unsigned int));
97int	 chdir __P((const char *));
98#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
99int	chown __P((const char *, uid_t, gid_t)) __RENAME(__posix_chown);
100#else
101int	chown __P((const char *, uid_t, gid_t));
102#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
103int	 close __P((int));
104size_t	 confstr __P((int, char *, size_t));
105char	*cuserid __P((char *));	/* obsolete */
106int	 dup __P((int));
107int	 dup2 __P((int, int));
108int	 execl __P((const char *, const char *, ...));
109int	 execle __P((const char *, const char *, ...));
110int	 execlp __P((const char *, const char *, ...));
111int	 execv __P((const char *, char * const *));
112int	 execve __P((const char *, char * const *, char * const *));
113int	 execvp __P((const char *, char * const *));
114pid_t	 fork __P((void));
115long	 fpathconf __P((int, int));
116char	*getcwd __P((char *, size_t));
117gid_t	 getegid __P((void));
118uid_t	 geteuid __P((void));
119gid_t	 getgid __P((void));
120int	 getgroups __P((int, gid_t []));
121__aconst char *getlogin __P((void));
122pid_t	 getpgrp __P((void));
123pid_t	 getpid __P((void));
124pid_t	 getppid __P((void));
125uid_t	 getuid __P((void));
126int	 isatty __P((int));
127int	 link __P((const char *, const char *));
128off_t	 lseek __P((int, off_t, int));
129long	 pathconf __P((const char *, int));
130int	 pause __P((void));
131int	 pipe __P((int *));
132ssize_t	 read __P((int, void *, size_t));
133int	 rmdir __P((const char *));
134int	 setgid __P((gid_t));
135int	 setpgid __P((pid_t, pid_t));
136pid_t	 setsid __P((void));
137int	 setuid __P((uid_t));
138unsigned int	 sleep __P((unsigned int));
139long	 sysconf __P((int));
140pid_t	 tcgetpgrp __P((int));
141int	 tcsetpgrp __P((int, pid_t));
142__aconst char *ttyname __P((int));
143int	 unlink __P((const char *));
144ssize_t	 write __P((int, const void *, size_t));
145
146
147/*
148 * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
149 */
150#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
151    (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 4
152int	 getopt __P((int, char * const [], const char *));
153
154extern	 char *optarg;			/* getopt(3) external variables */
155extern	 int opterr;
156extern	 int optind;
157extern	 int optopt;
158#endif
159
160
161/*
162 * IEEE Std 1003.1b-93,
163 * also found in X/Open Portability Guide >= Issue 4 Verion 2
164 */
165#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
166    (_POSIX_C_SOURCE - 0) >= 199309L || \
167    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
168    (_XOPEN_SOURCE - 0) >= 500
169int	 ftruncate __P((int, off_t));
170#endif
171
172
173/*
174 * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
175 */
176#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
177    (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500
178int	 fdatasync __P((int));
179int	 fsync __P((int));
180#endif
181
182
183/*
184 * X/Open Portability Guide, all issues
185 */
186#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
187int	 chroot __P((const char *));
188int	 nice __P((int));
189#endif
190
191
192/*
193 * X/Open Portability Guide <= Issue 3
194 */
195#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) <= 3
196int	 rename __P((const char *, const char *)) __RENAME(__posix_rename);
197#endif
198
199
200/*
201 * X/Open Portability Guide >= Issue 4
202 */
203#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
204    (_XOPEN_SOURCE - 0) >= 4
205__aconst char *crypt __P((const char *, const char *));
206int	 encrypt __P((char *, int));
207char	*getpass __P((const char *));
208pid_t	 getsid __P((pid_t));
209#endif
210
211
212/*
213 * X/Open Portability Guide >= Issue 4 Version 2
214 */
215#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
216    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
217    (_XOPEN_SOURCE - 0) >= 500
218#ifdef  _BSD_INTPTR_T_
219typedef _BSD_INTPTR_T_	intptr_t;
220#undef  _BSD_INTPTR_T_
221#endif
222
223#define F_ULOCK		0
224#define F_LOCK		1
225#define F_TLOCK		2
226#define F_TEST		3
227
228int	 brk __P((void *));
229int	 fchdir __P((int));
230#if defined(_XOPEN_SOURCE)
231int	 fchown __P((int, uid_t, gid_t)) __RENAME(__posix_fchown);
232#else
233int	 fchown __P((int, uid_t, gid_t));
234#endif
235int	 getdtablesize __P((void));
236long	 gethostid __P((void));
237int	 gethostname __P((char *, size_t));
238__pure int
239	 getpagesize __P((void));		/* legacy */
240pid_t	 getpgid __P((pid_t));
241#if defined(_XOPEN_SOURCE)
242int	 lchown __P((const char *, uid_t, gid_t)) __RENAME(__posix_lchown);
243#else
244int	 lchown __P((const char *, uid_t, gid_t));
245#endif
246int	 lockf __P((int, int, off_t));
247int	 readlink __P((const char *, char *, size_t));
248void	*sbrk __P((intptr_t));
249/* XXX prototype wrong! */
250int	 setpgrp __P((pid_t pid, pid_t pgrp));	/* obsoleted by setpgid() */
251int	 setregid __P((gid_t, gid_t));
252int	 setreuid __P((uid_t, uid_t));
253void	 swab __P((const void *, void *, size_t));
254int	 symlink __P((const char *, const char *));
255void	 sync __P((void));
256int	 truncate __P((const char *, off_t));
257useconds_t ualarm __P((useconds_t, useconds_t));
258int	 usleep __P((useconds_t));
259#ifdef __LIBC12_SOURCE__
260pid_t	 vfork __P((void));
261pid_t	 __vfork14 __P((void));
262#else
263pid_t	 vfork __P((void))			__RENAME(__vfork14);
264#endif
265
266#ifndef __AUDIT__
267char	*getwd __P((char *));			/* obsoleted by getcwd() */
268#endif
269
270/* FIXME: this should go to <sys/time.h>! */
271#if __STDC__
272struct timeval;				/* select(2) XXX */
273#endif
274int	 select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
275#endif /* (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || ... */
276
277
278/*
279 * X/Open CAE Specification Issue 5 Version 2
280 */
281#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
282    (_XOPEN_SOURCE - 0) >= 500
283ssize_t	 pread __P((int, void *, size_t, off_t));
284ssize_t	 pwrite __P((int, const void *, size_t, off_t));
285#endif
286
287
288/*
289 * Implementation-defined extensions
290 */
291#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
292int	 acct __P((const char *));
293int	 des_cipher __P((const char *, char *, long, int));
294int	 des_setkey __P((const char *key));
295void	 endusershell __P((void));
296int	 exect __P((const char *, char * const *, char * const *));
297int	 fchroot __P((int));
298int	 getdomainname __P((char *, size_t));
299int	 getgrouplist __P((const char *, gid_t, gid_t *, int *));
300mode_t	 getmode __P((const void *, mode_t));
301int	 getsubopt __P((char **, char * const *, char **));
302__aconst char *getusershell __P((void));
303int	 initgroups __P((const char *, gid_t));
304int	 iruserok __P((u_int32_t, int, const char *, const char *));
305int	 nfssvc __P((int, void *));
306int	 profil __P((char *, size_t, u_long, u_int));
307void	 psignal __P((unsigned int, const char *));
308int	 rcmd __P((char **, int, const char *,
309	    const char *, const char *, int *));
310int	 reboot __P((int, char *));
311int	 revoke __P((const char *));
312int	 rresvport __P((int *));
313int	 ruserok __P((const char *, int, const char *, const char *));
314int	 setdomainname __P((const char *, size_t));
315int	 setegid __P((gid_t));
316int	 seteuid __P((uid_t));
317int	 setgroups __P((int, const gid_t *));
318int	 sethostid __P((long));
319int	 sethostname __P((const char *, size_t));
320int	 setlogin __P((const char *));
321void	*setmode __P((const char *));
322int	 setrgid __P((gid_t));
323int	 setruid __P((uid_t));
324void	 setusershell __P((void));
325void	 strmode __P((mode_t, char *));
326__aconst char *strsignal __P((int));
327int	 swapctl __P((int, const void *, int));
328int	 swapon __P((const char *));		/* obsoleted by swapctl() */
329int	 syscall __P((int, ...));
330quad_t	 __syscall __P((quad_t, ...));
331int	 undelete __P((const char *));
332
333#if 1 /*INET6*/
334int	 rresvport_af __P((int *, int));
335int	 ruserok_af __P((const char *, int, const char *, const char *, int));
336int	 iruserok_af __P((const void *, int, const char *, const char *, int));
337#endif
338
339extern __const char *__const *sys_siglist __RENAME(__sys_siglist14);
340extern	 int optreset;		/* getopt(3) external variable */
341extern	 char *suboptarg;	/* getsubopt(3) external variable */
342#endif
343
344__END_DECLS
345
346#endif /* !_UNISTD_H_ */
347