]> git.saurik.com Git - apple/libc.git/blob - include/unistd.h
2bec5941740233b2fbddcc7b495ff3ff5b48c31c
[apple/libc.git] / include / unistd.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*-
26 * Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
27 * Copyright (c) 1991, 1993, 1994
28 * The Regents of the University of California. All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
42 * 4. Neither the name of the University nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
58 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
59 *
60 * Copyright (c) 1998 Apple Compter, Inc.
61 * All Rights Reserved
62 */
63
64 /* History:
65 7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
66 3/26/98 CHW at Apple added real interface to searchfs call
67 3/5/98 CHW at Apple added hfs semantic system calls headers
68 */
69
70 #ifndef _UNISTD_H_
71 #define _UNISTD_H_
72
73 #include <sys/cdefs.h>
74 #include <sys/types.h>
75 #include <sys/unistd.h>
76
77 #define STDIN_FILENO 0 /* standard input file descriptor */
78 #define STDOUT_FILENO 1 /* standard output file descriptor */
79 #define STDERR_FILENO 2 /* standard error file descriptor */
80
81 #ifndef NULL
82 #define NULL 0 /* null pointer constant */
83 #endif
84
85 #define _POSIX_THREADS /* We support pthreads */
86
87 #ifndef _POSIX_SOURCE
88 #define F_ULOCK 0 /* unlock locked section */
89 #define F_LOCK 1 /* lock a section for exclusive use */
90 #define F_TLOCK 2 /* test and lock a section for exclusive use */
91 #define F_TEST 3 /* test a section for locks by other procs */
92 #endif
93
94 /* configurable system variables */
95 #define _SC_ARG_MAX 1
96 #define _SC_CHILD_MAX 2
97 #define _SC_CLK_TCK 3
98 #define _SC_NGROUPS_MAX 4
99 #define _SC_OPEN_MAX 5
100 #define _SC_JOB_CONTROL 6
101 #define _SC_SAVED_IDS 7
102 #define _SC_VERSION 8
103 #define _SC_BC_BASE_MAX 9
104 #define _SC_BC_DIM_MAX 10
105 #define _SC_BC_SCALE_MAX 11
106 #define _SC_BC_STRING_MAX 12
107 #define _SC_COLL_WEIGHTS_MAX 13
108 #define _SC_EXPR_NEST_MAX 14
109 #define _SC_LINE_MAX 15
110 #define _SC_RE_DUP_MAX 16
111 #define _SC_2_VERSION 17
112 #define _SC_2_C_BIND 18
113 #define _SC_2_C_DEV 19
114 #define _SC_2_CHAR_TERM 20
115 #define _SC_2_FORT_DEV 21
116 #define _SC_2_FORT_RUN 22
117 #define _SC_2_LOCALEDEF 23
118 #define _SC_2_SW_DEV 24
119 #define _SC_2_UPE 25
120 #define _SC_STREAM_MAX 26
121 #define _SC_TZNAME_MAX 27
122 /* POSIX.1B sysconf options for async IO*/
123 #define _SC_ASYNCHRONOUS_IO 28
124 #define _SC_PAGESIZE 29
125 #define _SC_AIO_LISTIO_MAX 42
126 #define _SC_AIO_MAX 43
127 #define _SC_AIO_PRIO_DELTA_MAX 44
128
129 __BEGIN_DECLS
130
131 void _Exit(int) __dead2;
132 void _exit(int) __dead2;
133 int access(const char *, int);
134 unsigned int alarm(unsigned int);
135 int chdir(const char *);
136 int chown(const char *, uid_t, gid_t);
137 int close(int);
138 size_t confstr(int, char *, size_t);
139 int dup(int);
140 int dup2(int, int);
141 int execl(const char *, const char *, ...);
142 int execle(const char *, const char *, ...);
143 int execlp(const char *, const char *, ...);
144 int execv(const char *, char * const *);
145 int execve(const char *, char * const *, char * const *);
146 int execvp(const char *, char * const *);
147 pid_t fork(void);
148 long fpathconf(int, int);
149 char *getcwd(char *, size_t);
150 int getdomainname(char *, int);
151 gid_t getegid(void);
152 uid_t geteuid(void);
153 gid_t getgid(void);
154 int getgroups(int, gid_t []);
155 char *getlogin(void);
156 int getlogin_r(char *, int);
157 pid_t getpgrp(void);
158 pid_t getpid(void);
159 pid_t getppid(void);
160 uid_t getuid(void);
161 int isatty(int);
162 int link(const char *, const char *);
163 off_t lseek(int, off_t, int);
164 long pathconf(const char *, int);
165 int pause(void);
166 int pipe(int *);
167 ssize_t read(int, void *, size_t);
168 int rmdir(const char *);
169 int setdomainname(const char *, int);
170 int setgid(gid_t);
171 int setpgid(pid_t, pid_t);
172 pid_t setsid(void);
173 int setuid(uid_t);
174 unsigned int sleep(unsigned int);
175 long sysconf(int);
176 pid_t tcgetpgrp(int);
177 int tcsetpgrp(int, pid_t);
178 char *ttyname(int);
179 char *ttyname_r(int, char *, size_t);
180 int unlink(const char *);
181 ssize_t write(int, const void *, size_t);
182
183 extern char *optarg; /* getopt(3) external variables */
184 extern int optind, opterr, optopt, optreset;
185 int getopt(int, char * const [], const char *);
186
187 #ifndef _POSIX_SOURCE
188 #ifdef __STDC__
189 struct timespec; /* pselect(3) */
190 struct timeval; /* select(2) */
191 #endif
192 int acct(const char *);
193 int async_daemon(void);
194 char *brk(const char *);
195 int chroot(const char *);
196 char *crypt(const char *, const char *);
197 int des_cipher(const char *, char *, long, int);
198 int des_setkey(const char *key);
199 int encrypt(char *, int);
200 void endusershell(void);
201 int fchdir(int);
202 int fchown(int, int, int);
203 char *fflagstostr(u_long);
204 int fsync(int);
205 int ftruncate(int, off_t);
206 int getdtablesize(void);
207 int getgrouplist(const char *, int, int *, int *);
208 long gethostid(void);
209 int gethostname(char *, int);
210 mode_t getmode(const void *, mode_t);
211 int getpagesize(void) __pure2;
212 char *getpass(const char *);
213 int getpgid(pid_t _pid);
214 int getsid(pid_t _pid);
215 char *getusershell(void);
216 char *getwd(char *); /* obsoleted by getcwd() */
217 int lockf(int, int, off_t);
218 int initgroups(const char *, int);
219 int iruserok(unsigned long, int, const char *, const char *);
220 int issetugid(void);
221 char *mkdtemp(char *);
222 int mknod(const char *, mode_t, dev_t);
223 int mkstemp(char *);
224 int mkstemps(char *, int);
225 char *mktemp(char *);
226 int nfssvc(int, void *);
227 int nice(int);
228 ssize_t pread(int, void *, size_t, off_t);
229 #if 0
230 void psignal(unsigned int, const char *);
231 extern __const char *__const sys_siglist[];
232 #else
233 #include <signal.h>
234 #endif
235 int profil(char *, int, int, int);
236 #ifndef __MWERKS__
237 int pselect(int, fd_set *, fd_set *, fd_set *,
238 const struct timespec *, const sigset_t *);
239 #endif /* ! __MWERKS__ */
240 ssize_t pwrite(int, const void *, size_t, off_t);
241 int rcmd(char **, int, const char *, const char *, const char *, int *);
242 int readlink(const char *, char *, int);
243 int reboot(int);
244 int revoke(const char *);
245 int rresvport(int *);
246 int rresvport_af(int *, int);
247 int ruserok(const char *, int, const char *, const char *);
248 char *sbrk(int);
249 int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
250 int setegid(gid_t);
251 int seteuid(uid_t);
252 int setgroups(int, const gid_t *);
253 void sethostid(long);
254 int sethostname(const char *, int);
255 int setkey(const char *);
256 int setlogin(const char *);
257 void *setmode(const char *);
258 int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
259 int setregid(gid_t, gid_t);
260 int setreuid(uid_t, uid_t);
261 int setrgid(gid_t);
262 int setruid(uid_t);
263 void setusershell(void);
264 int strtofflags(char **, u_long *, u_long *);
265 int swapon(const char *);
266 int symlink(const char *, const char *);
267 void sync(void);
268 int syscall(int, ...);
269 int truncate(const char *, off_t);
270 int ttyslot(void);
271 unsigned int ualarm(unsigned int, unsigned int);
272 int undelete(const char *);
273 int unwhiteout(const char *);
274 int usleep(unsigned int);
275 void *valloc(size_t);
276 pid_t vfork(void);
277
278 extern char *suboptarg; /* getsubopt(3) external variable */
279 int getsubopt(char **, char * const *, char **);
280
281 /* HFS & HFS Plus semantics system calls go here */
282 int getattrlist(const char*,void*,void*,size_t,unsigned long);
283 int setattrlist(const char*,void*,void*,size_t,unsigned long);
284 int exchangedata(const char*,const char*,unsigned long);
285 int checkuseraccess(const char*,uid_t,gid_t*,int,int,unsigned long);
286 int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long);
287 int searchfs(const char*,void*,void*,unsigned long,unsigned long,void*);
288
289 int fsctl(const char *,unsigned long,void*,unsigned long);
290
291
292 #endif /* !_POSIX_SOURCE */
293 __END_DECLS
294
295 #endif /* !_UNISTD_H_ */