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