Annotation of src/include/unistd.h, Revision 1.58
1.58 ! espie 1: /* $OpenBSD: unistd.h,v 1.57 2005/12/13 00:35:22 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:
1.57 millert 46: #if __XPG_VISIBLE || __POSIX_VISIBLE >= 200112
47: #define F_ULOCK 0 /* unlock locked section */
48: #define F_LOCK 1 /* lock a section for exclusive use */
49: #define F_TLOCK 2 /* test and lock a section for exclusive use */
50: #define F_TEST 3 /* test a section for locks by other procs */
51: #endif
52:
1.1 deraadt 53: #ifndef NULL
1.26 espie 54: #ifdef __GNUG__
1.27 espie 55: #define NULL __null
1.26 espie 56: #else
1.43 millert 57: #define NULL 0L
1.26 espie 58: #endif
1.1 deraadt 59: #endif
60:
61: __BEGIN_DECLS
1.36 millert 62: __dead void _exit(int);
63: int access(const char *, int);
64: unsigned int alarm(unsigned int);
65: int chdir(const char *);
66: int chown(const char *, uid_t, gid_t);
67: int close(int);
68: int dup(int);
69: int dup2(int, int);
1.40 espie 70: int execl(const char *, const char *, ...)
71: __attribute__((sentinel));
72: int execle(const char *, const char *, ...)
73: __attribute__((sentinel));
74: int execlp(const char *, const char *, ...)
75: __attribute__((sentinel));
1.36 millert 76: int execv(const char *, char * const *);
77: int execve(const char *, char * const *, char * const *);
78: int execvp(const char *, char * const *);
79: pid_t fork(void);
80: long fpathconf(int, int);
1.50 avsm 81: char *getcwd(char *, size_t)
82: __attribute__((__bounded__(__string__,1,2)))
83: __attribute__((__bounded__(__minbytes__,1,1024)));
1.36 millert 84: gid_t getegid(void);
85: uid_t geteuid(void);
86: gid_t getgid(void);
87: int getgroups(int, gid_t *);
88: char *getlogin(void);
89: pid_t getpgrp(void);
90: pid_t getpid(void);
91: pid_t getppid(void);
92: uid_t getuid(void);
93: int isatty(int);
94: int link(const char *, const char *);
95: off_t lseek(int, off_t, int);
96: long pathconf(const char *, int);
97: int pause(void);
98: int pipe(int *);
1.50 avsm 99: ssize_t read(int, void *, size_t)
100: __attribute__((__bounded__(__buffer__,2,3)));
1.36 millert 101: int rmdir(const char *);
102: int setgid(gid_t);
103: int setuid(uid_t);
104: unsigned int sleep(unsigned int);
105: long sysconf(int);
106: pid_t tcgetpgrp(int);
107: int tcsetpgrp(int, pid_t);
108: char *ttyname(int);
109: int unlink(const char *);
1.50 avsm 110: ssize_t write(int, const void *, size_t)
111: __attribute__((__bounded__(__buffer__,2,3)));
1.1 deraadt 112:
1.57 millert 113: #if __POSIX_VISIBLE || __XPG_VISIBLE >= 300
114: pid_t setsid(void);
115: int setpgid(pid_t, pid_t);
116: #endif
1.1 deraadt 117:
1.57 millert 118: #if __POSIX_VISIBLE >= 199209 || __XPG_VISIBLE
119: size_t confstr(int, char *, size_t)
120: __attribute__((__bounded__(__string__,2,3)));
121: #ifndef _GETOPT_DEFINED_
122: #define _GETOPT_DEFINED_
123: int getopt(int, char * const *, const char *);
124: extern char *optarg; /* getopt(3) external variables */
125: extern int opterr, optind, optopt, optreset;
126: /* XXX - getsubopt does not belong here */
127: int getsubopt(char **, char * const *, char **);
128: extern char *suboptarg; /* getsubopt(3) external variable */
129: #endif /* _GETOPT_DEFINED_ */
130: #endif
131:
132: #if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE
133: int fsync(int);
134: int ftruncate(int, off_t);
135: int getlogin_r(char *, size_t)
136: __attribute__((__bounded__(__string__,1,2)))
137: __attribute__((__bounded__(__minbytes__,1,32)));
138: #endif
1.1 deraadt 139:
1.57 millert 140: #if __XPG_VISIBLE || __BSD_VISIBLE
141: char *crypt(const char *, const char *);
142: int encrypt(char *, int);
143: int fchdir(int);
144: int fchown(int, uid_t, gid_t);
145: long gethostid(void);
146: char *getwd(char *)
147: __attribute__ ((__bounded__(__minbytes__,1,1024)));
148: int lchown(const char *, uid_t, gid_t);
149: int mkstemp(char *);
150: char *mktemp(char *);
151: int nice(int);
152: int readlink(const char *, char *, size_t)
153: __attribute__ ((__bounded__(__string__,2,3)));
154: int setkey(const char *);
155: int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
156: int setregid(gid_t, gid_t);
157: int setreuid(uid_t, uid_t);
158: void swab(const void *, void *, size_t);
159: void sync(void);
160: int truncate(const char *, off_t);
161: unsigned int ualarm(unsigned int, unsigned int);
162: int usleep(useconds_t);
163: pid_t vfork(void);
164: #endif
165:
166: #if __XPG_VISIBLE >= 420
167: pid_t getpgid(pid_t);
168: pid_t getsid(pid_t);
169: #endif
170:
171: #if __XPG_VISIBLE >= 500
1.36 millert 172: ssize_t pread(int, void *, size_t, off_t);
173: ssize_t pwrite(int, const void *, size_t, off_t);
1.57 millert 174: int ttyname_r(int, char *, size_t)
175: __attribute__((__bounded__(__string__,2,3)));
1.31 deraadt 176: #endif
177:
1.57 millert 178: #if __BSD_VISIBLE || __XPG_VISIBLE <= 500
179: /* Interfaces withdrawn by X/Open Issue 5 Version 0 */
180: void *brk(void *);
181: int chroot(const char *);
182: int getdtablesize(void);
183: int getpagesize(void);
184: char *getpass(const char *);
185: void *sbrk(int);
186: #endif
187:
188: #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420
189: int lockf(int, int, off_t);
190: #endif
191:
192: #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 || __BSD_VISIBLE
193: int symlink(const char *, const char *);
194: int gethostname(char *, size_t)
195: __attribute__ ((__bounded__(__string__,1,2)));
196: int setegid(gid_t);
197: int seteuid(uid_t);
198: #endif
199:
200: #if __BSD_VISIBLE
1.36 millert 201: int acct(const char *);
1.52 millert 202: int closefrom(int);
1.51 deraadt 203: int des_cipher(const char *, char *, int32_t, int);
1.58 ! espie 204: int des_setkey(const char *);
1.36 millert 205: void endusershell(void);
206: int exect(const char *, char * const *, char * const *);
207: char *fflagstostr(u_int32_t);
1.50 avsm 208: int getdomainname(char *, size_t)
209: __attribute__ ((__bounded__(__string__,1,2)));
1.36 millert 210: int getgrouplist(const char *, gid_t, gid_t *, int *);
211: mode_t getmode(const void *, mode_t);
1.44 millert 212: int getresgid(gid_t *, gid_t *, gid_t *);
213: int getresuid(uid_t *, uid_t *, uid_t *);
1.36 millert 214: char *getusershell(void);
215: int initgroups(const char *, gid_t);
216: int iruserok(u_int32_t, int, const char *, const char *);
217: int iruserok_sa(const void *, int, int, const char *, const char *);
1.57 millert 218: int issetugid(void);
219: char *mkdtemp(char *);
220: int mkstemps(char *, int);
1.36 millert 221: int nfssvc(int, void *);
222: void psignal(unsigned int, const char *);
1.50 avsm 223: int profil(char *, size_t, unsigned long, unsigned int)
224: __attribute__ ((__bounded__(__string__,1,2)));
1.57 millert 225: int quotactl(const char *, int, int, char *);
1.37 millert 226: int rcmd(char **, int, const char *,
227: const char *, const char *, int *);
228: int rcmd_af(char **, int, const char *,
229: const char *, const char *, int *, int);
230: int rcmdsh(char **, int, const char *,
231: const char *, const char *, char *);
1.36 millert 232: char *re_comp(const char *);
233: int re_exec(const char *);
234: int reboot(int);
235: int revoke(const char *);
236: int rfork(int opts);
237: int rresvport(int *);
238: int rresvport_af(int *, int);
239: int ruserok(const char *, int, const char *, const char *);
1.57 millert 240: #ifndef _SELECT_DEFINED_
241: #define _SELECT_DECLARED
242: struct timeval;
1.36 millert 243: int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
1.19 deraadt 244: #endif
1.36 millert 245: int setdomainname(const char *, size_t);
246: int setgroups(int, const gid_t *);
247: int sethostid(long);
248: int sethostname(const char *, size_t);
249: int setlogin(const char *);
250: void *setmode(const char *);
1.44 millert 251: int setresgid(gid_t, gid_t, gid_t);
252: int setresuid(uid_t, uid_t, uid_t);
1.36 millert 253: int setrgid(gid_t);
254: int setruid(uid_t);
255: void setusershell(void);
256: int strtofflags(char **, u_int32_t *, u_int32_t *);
257: int swapctl(int cmd, const void *arg, int misc);
258: int syscall(int, ...);
1.57 millert 259: extern __const char *__const sys_siglist[]; /* XXX - also in signal.h */
260: #endif /* __BSD_VISIBLE */
1.1 deraadt 261: __END_DECLS
262:
263: #endif /* !_UNISTD_H_ */