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