Annotation of src/include/unistd.h, Revision 1.48
1.48 ! avsm 1: /* $OpenBSD: unistd.h,v 1.47 2003/06/02 19:34:12 millert Exp $ */
1.6 deraadt 2: /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1991 The Regents of the University of California.
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
1.47 millert 16: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30: * SUCH DAMAGE.
31: *
32: * @(#)unistd.h 5.13 (Berkeley) 6/17/91
33: */
34:
35: #ifndef _UNISTD_H_
36: #define _UNISTD_H_
37:
38: #include <sys/cdefs.h>
39: #include <sys/types.h>
40: #include <sys/unistd.h>
41:
42: #define STDIN_FILENO 0 /* standard input file descriptor */
43: #define STDOUT_FILENO 1 /* standard output file descriptor */
44: #define STDERR_FILENO 2 /* standard error file descriptor */
45:
46: #ifndef NULL
1.26 espie 47: #ifdef __GNUG__
1.27 espie 48: #define NULL __null
1.26 espie 49: #else
1.43 millert 50: #define NULL 0L
1.26 espie 51: #endif
1.1 deraadt 52: #endif
53:
54: __BEGIN_DECLS
1.36 millert 55: __dead void _exit(int);
56: int access(const char *, int);
57: unsigned int alarm(unsigned int);
58: int chdir(const char *);
59: int chown(const char *, uid_t, gid_t);
60: int close(int);
1.48 ! avsm 61: size_t confstr(int, char *, size_t)
! 62: __attribute__((__bounded__(__string__,2,3)));
1.36 millert 63: char *cuserid(char *);
64: int dup(int);
65: int dup2(int, int);
1.40 espie 66: int execl(const char *, const char *, ...)
67: __attribute__((sentinel));
68: int execle(const char *, const char *, ...)
69: __attribute__((sentinel));
70: int execlp(const char *, const char *, ...)
71: __attribute__((sentinel));
1.36 millert 72: int execv(const char *, char * const *);
73: int execve(const char *, char * const *, char * const *);
74: int execvp(const char *, char * const *);
75: pid_t fork(void);
76: long fpathconf(int, int);
1.48 ! avsm 77: char *getcwd(char *, size_t)
! 78: __attribute__((__bounded__(__string__,1,2)))
! 79: __attribute__((__bounded__(__minbytes__,1,1024)));
1.36 millert 80: gid_t getegid(void);
81: uid_t geteuid(void);
82: gid_t getgid(void);
83: int getgroups(int, gid_t *);
84: char *getlogin(void);
1.48 ! avsm 85: int getlogin_r(char *, size_t)
! 86: __attribute__((__bounded__(__string__,1,2)))
! 87: __attribute__((__bounded__(__minbytes__,1,32)));
1.36 millert 88: pid_t getpgrp(void);
89: pid_t getpid(void);
90: pid_t getpgid(pid_t);
91: pid_t getppid(void);
92: pid_t getsid(pid_t);
93: uid_t getuid(void);
94: int isatty(int);
95: int link(const char *, const char *);
96: off_t lseek(int, off_t, int);
97: long pathconf(const char *, int);
98: int pause(void);
99: int pipe(int *);
1.48 ! avsm 100: ssize_t read(int, void *, size_t)
! 101: __attribute__((__bounded__(__buffer__,2,3)));
1.36 millert 102: int rmdir(const char *);
103: int setgid(gid_t);
104: int setpgid(pid_t, pid_t);
105: pid_t setsid(void);
106: int setuid(uid_t);
107: unsigned int sleep(unsigned int);
108: long sysconf(int);
109: pid_t tcgetpgrp(int);
110: int tcsetpgrp(int, pid_t);
111: char *ttyname(int);
1.48 ! avsm 112: int ttyname_r(int, char *, size_t)
! 113: __attribute__((__bounded__(__string__,2,3)));
1.36 millert 114: int unlink(const char *);
1.48 ! avsm 115: ssize_t write(int, const void *, size_t)
! 116: __attribute__((__bounded__(__buffer__,2,3)));
1.1 deraadt 117:
118: #ifndef _POSIX_SOURCE
119:
120: /* structure timeval required for select() */
121: #include <sys/time.h>
122:
1.31 deraadt 123: /*
124: * X/Open CAE Specification Issue 5 Version 2
125: */
126: #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
127: (_XOPEN_VERSION - 0) >= 500
1.36 millert 128: ssize_t pread(int, void *, size_t, off_t);
129: ssize_t pwrite(int, const void *, size_t, off_t);
1.31 deraadt 130: #endif
131:
1.36 millert 132: int acct(const char *);
133: char *brk(const char *);
134: int chroot(const char *);
135: char *crypt(const char *, const char *);
136: int des_cipher(const char *, char *, long, int);
137: int des_setkey(const char *key);
138: int encrypt(char *, int);
139: void endusershell(void);
140: int exect(const char *, char * const *, char * const *);
141: int fchdir(int);
142: int fchown(int, uid_t, gid_t);
143: char *fflagstostr(u_int32_t);
144: int fsync(int);
145: int ftruncate(int, off_t);
1.48 ! avsm 146: int getdomainname(char *, size_t)
! 147: __attribute__ ((__bounded__(__string__,1,2)));
1.36 millert 148: int getdtablesize(void);
149: int getgrouplist(const char *, gid_t, gid_t *, int *);
150: long gethostid(void);
1.48 ! avsm 151: int gethostname(char *, size_t)
! 152: __attribute__ ((__bounded__(__string__,1,2)));
1.36 millert 153: mode_t getmode(const void *, mode_t);
154: int getpagesize(void);
1.44 millert 155: int getresgid(gid_t *, gid_t *, gid_t *);
156: int getresuid(uid_t *, uid_t *, uid_t *);
1.36 millert 157: char *getpass(const char *);
158: char *getusershell(void);
1.48 ! avsm 159: char *getwd(char *)
! 160: __attribute__ ((__bounded__(__minbytes__,1,1024)));
1.36 millert 161: int initgroups(const char *, gid_t);
162: int iruserok(u_int32_t, int, const char *, const char *);
163: int iruserok_sa(const void *, int, int, const char *, const char *);
164: int lchown(const char *, uid_t, gid_t);
165: char *mkdtemp(char *);
166: int mkstemp(char *);
167: int mkstemps(char *, int);
168: char *mktemp(char *);
169: int nfssvc(int, void *);
170: int nice(int);
171: void psignal(unsigned int, const char *);
1.1 deraadt 172: extern __const char *__const sys_siglist[];
1.48 ! avsm 173: int profil(char *, size_t, unsigned long, unsigned int)
! 174: __attribute__ ((__bounded__(__string__,1,2)));
1.37 millert 175: int rcmd(char **, int, const char *,
176: const char *, const char *, int *);
177: int rcmd_af(char **, int, const char *,
178: const char *, const char *, int *, int);
179: int rcmdsh(char **, int, const char *,
180: const char *, const char *, char *);
1.36 millert 181: char *re_comp(const char *);
182: int re_exec(const char *);
1.48 ! avsm 183: int readlink(const char *, char *, size_t)
! 184: __attribute__ ((__bounded__(__string__,2,3)));
1.36 millert 185: int reboot(int);
186: int revoke(const char *);
187: int rfork(int opts);
188: int rresvport(int *);
189: int rresvport_af(int *, int);
190: int ruserok(const char *, int, const char *, const char *);
191: int quotactl(const char *, int, int, char *);
192: char *sbrk(int);
1.31 deraadt 193:
194: #if !defined(_XOPEN_SOURCE)
1.36 millert 195: int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
1.19 deraadt 196: #endif
1.31 deraadt 197:
1.36 millert 198: int setdomainname(const char *, size_t);
199: int setegid(gid_t);
200: int seteuid(uid_t);
201: int setgroups(int, const gid_t *);
202: int sethostid(long);
203: int sethostname(const char *, size_t);
204: int setkey(const char *);
205: int setlogin(const char *);
206: void *setmode(const char *);
207: int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
1.44 millert 208: int setregid(gid_t, gid_t);
209: int setresgid(gid_t, gid_t, gid_t);
210: int setresuid(uid_t, uid_t, uid_t);
211: int setreuid(uid_t, uid_t);
1.36 millert 212: int setrgid(gid_t);
213: int setruid(uid_t);
214: void setusershell(void);
215: int strtofflags(char **, u_int32_t *, u_int32_t *);
216: void swab(const void *, void *, size_t);
217: int swapctl(int cmd, const void *arg, int misc);
218: int symlink(const char *, const char *);
219: void sync(void);
220: int syscall(int, ...);
221: int truncate(const char *, off_t);
222: int ttyslot(void);
223: unsigned int ualarm(unsigned int, unsigned int);
224: int undelete(const char *);
225: int usleep(useconds_t);
226: void *valloc(size_t); /* obsoleted by malloc() */
227: pid_t vfork(void);
228: int issetugid(void);
1.1 deraadt 229:
1.45 millert 230: #ifndef _GETOPT_DEFINED_
231: #define _GETOPT_DEFINED_
1.36 millert 232: int getopt(int, char * const *, const char *);
1.1 deraadt 233: extern char *optarg; /* getopt(3) external variables */
234: extern int opterr;
235: extern int optind;
236: extern int optopt;
237: extern int optreset;
1.36 millert 238: int getsubopt(char **, char * const *, char **);
1.1 deraadt 239: extern char *suboptarg; /* getsubopt(3) external variable */
1.45 millert 240: #endif /* _GETOPT_DEFINED_ */
1.1 deraadt 241: #endif /* !_POSIX_SOURCE */
1.15 deraadt 242:
243: #if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
244: !defined(_XOPEN_SOURCE)) || \
245: (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
246: #define F_ULOCK 0
247: #define F_LOCK 1
248: #define F_TLOCK 2
249: #define F_TEST 3
1.36 millert 250: int lockf(int, int, off_t);
1.15 deraadt 251: #endif /* (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || ... */
1.1 deraadt 252: __END_DECLS
253:
254: #endif /* !_UNISTD_H_ */