10 #include <sys/_types.h>
12 #define __need_ptrdiff_t
15 extern char **environ;
17 void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn)));
19 int _EXFUN(access,(const char *__path, int __amode ));
20 unsigned _EXFUN(alarm, (unsigned __secs ));
21 int _EXFUN(chdir, (const char *__path ));
22 int _EXFUN(chmod, (const char *__path, mode_t __mode ));
23 #if !defined(__INSIDE_CYGWIN__)
24 int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group ));
26 #if defined(__CYGWIN__) || defined(__rtems__)
27 int _EXFUN(chroot, (const char *__path ));
29 int _EXFUN(close, (int __fildes ));
30 char _EXFUN(*ctermid, (char *__s ));
31 char _EXFUN(*cuserid, (char *__s ));
32 #if defined(__CYGWIN__)
33 int _EXFUN(daemon, (int nochdir, int noclose));
35 int _EXFUN(dup, (int __fildes ));
36 int _EXFUN(dup2, (int __fildes, int __fildes2 ));
37 #if defined(__CYGWIN__)
38 void _EXFUN(endusershell, (void));
40 int _EXFUN(execl, (const char *__path, const char *, ... ));
41 int _EXFUN(execle, (const char *__path, const char *, ... ));
42 int _EXFUN(execlp, (const char *__file, const char *, ... ));
43 int _EXFUN(execv, (const char *__path, char * const __argv[] ));
44 int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
45 int _EXFUN(execvp, (const char *__file, char * const __argv[] ));
46 #if defined(__CYGWIN__) || defined(__rtems__)
47 int _EXFUN(fchdir, (int __fildes));
49 int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
50 #if !defined(__INSIDE_CYGWIN__)
51 int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
53 pid_t _EXFUN(fork, (void ));
54 long _EXFUN(fpathconf, (int __fd, int __name ));
55 int _EXFUN(fsync, (int __fd));
56 int _EXFUN(fdatasync, (int __fd));
57 char _EXFUN(*getcwd, (char *__buf, size_t __size ));
58 #if defined(__CYGWIN__)
59 int _EXFUN(getdomainname ,(char *__name, size_t __len));
61 #if !defined(__INSIDE_CYGWIN__)
62 gid_t _EXFUN(getegid, (void ));
63 uid_t _EXFUN(geteuid, (void ));
64 gid_t _EXFUN(getgid, (void ));
66 int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
67 #if defined(__CYGWIN__)
68 long _EXFUN(gethostid, (void));
70 char _EXFUN(*getlogin, (void ));
71 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
72 int _EXFUN(getlogin_r, (char *name, size_t namesize) );
74 char _EXFUN(*getpass, (const char *__prompt));
75 size_t _EXFUN(getpagesize, (void));
76 #if defined(__CYGWIN__)
77 int _EXFUN(getpeereid, (int, uid_t *, gid_t *));
79 pid_t _EXFUN(getpgid, (pid_t));
80 pid_t _EXFUN(getpgrp, (void ));
81 pid_t _EXFUN(getpid, (void ));
82 pid_t _EXFUN(getppid, (void ));
84 pid_t _EXFUN(getsid, (pid_t));
86 #if !defined(__INSIDE_CYGWIN__)
87 uid_t _EXFUN(getuid, (void ));
90 char * _EXFUN(getusershell, (void));
91 char _EXFUN(*getwd, (char *__buf ));
92 int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser));
94 int _EXFUN(isatty, (int __fildes ));
95 #if !defined(__INSIDE_CYGWIN__)
96 int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
98 int _EXFUN(link, (const char *__path1, const char *__path2 ));
99 int _EXFUN(nice, (int __nice_value ));
100 #if !defined(__INSIDE_CYGWIN__)
101 off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
103 long _EXFUN(pathconf, (const char *__path, int __name ));
104 int _EXFUN(pause, (void ));
106 int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void)));
108 int _EXFUN(pipe, (int __fildes[2] ));
109 ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset));
110 ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset));
111 _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));
112 #if defined(__CYGWIN__)
113 int _EXFUN(rresvport, (int *__alport));
114 int _EXFUN(revoke, (char *__path));
116 int _EXFUN(rmdir, (const char *__path ));
117 #if defined(__CYGWIN__)
118 int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser));
120 void * _EXFUN(sbrk, (ptrdiff_t __incr));
121 #if !defined(__INSIDE_CYGWIN__)
122 #if defined(__CYGWIN__)
123 int _EXFUN(setegid, (gid_t __gid ));
124 int _EXFUN(seteuid, (uid_t __uid ));
126 int _EXFUN(setgid, (gid_t __gid ));
128 #if defined(__CYGWIN__)
129 int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist ));
131 int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
132 int _EXFUN(setpgrp, (void ));
133 #if defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
134 int _EXFUN(setregid, (gid_t __rgid, gid_t __egid));
135 int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid));
137 pid_t _EXFUN(setsid, (void ));
138 #if !defined(__INSIDE_CYGWIN__)
139 int _EXFUN(setuid, (uid_t __uid ));
141 #if defined(__CYGWIN__)
142 void _EXFUN(setusershell, (void));
144 unsigned _EXFUN(sleep, (unsigned int __seconds ));
145 void _EXFUN(swab, (const void *, void *, ssize_t));
146 long _EXFUN(sysconf, (int __name ));
147 pid_t _EXFUN(tcgetpgrp, (int __fildes ));
148 int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
149 char _EXFUN(*ttyname, (int __fildes ));
150 #if defined(__CYGWIN__)
151 int _EXFUN(ttyname_r, (int, char *, size_t));
153 int _EXFUN(unlink, (const char *__path ));
154 int _EXFUN(vhangup, (void ));
155 _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte ));
158 # define __UNISTD_GETOPT__
160 # undef __UNISTD_GETOPT__
162 extern char *optarg; /* getopt(3) external variables */
163 extern int optind, opterr, optopt;
164 int getopt(int, char * const [], const char *);
165 extern int optreset; /* getopt(3) external variable */
168 #ifndef _POSIX_SOURCE
169 pid_t _EXFUN(vfork, (void ));
171 extern char *suboptarg; /* getsubopt(3) external variable */
172 int getsubopt(char **, char * const *, char **);
173 #endif /* _POSIX_SOURCE */
175 #ifdef _COMPILING_NEWLIB
176 /* Provide prototypes for most of the _<systemcall> names that are
177 provided in newlib for some compilers. */
178 int _EXFUN(_close, (int __fildes ));
179 pid_t _EXFUN(_fork, (void ));
180 pid_t _EXFUN(_getpid, (void ));
181 int _EXFUN(_link, (const char *__path1, const char *__path2 ));
182 _off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence ));
183 #ifdef __LARGE64_FILES
184 _off64_t _EXFUN(_lseek64, (int __filedes, _off64_t __offset, int __whence ));
186 _READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte ));
187 void * _EXFUN(_sbrk, (ptrdiff_t __incr));
188 int _EXFUN(_unlink, (const char *__path ));
189 _READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte ));
190 int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
193 #if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__)
194 #if !defined(__INSIDE_CYGWIN__)
195 int _EXFUN(ftruncate, (int __fd, off_t __length));
196 int _EXFUN(truncate, (const char *, off_t __length));
199 #if defined(__CYGWIN__) || defined(__rtems__)
200 int _EXFUN(getdtablesize, (void));
201 int _EXFUN(setdtablesize, (int));
202 useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
203 unsigned _EXFUN(usleep, (unsigned int __useconds));
204 #if !(defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
205 /* winsock[2].h defines as __stdcall, and with int as 2nd arg */
206 int _EXFUN(gethostname, (char *__name, size_t __len));
208 char * _EXFUN(mktemp, (char *));
209 #if defined(__CYGWIN__)
210 void _EXFUN(sync, (void));
211 #else /* defined(__rtems__) */
212 int _EXFUN(sync, (void));
215 int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
216 int _EXFUN(symlink, (const char *__name1, const char *__name2));
227 #include <sys/features.h>
229 #define STDIN_FILENO 0 /* standard input file descriptor */
230 #define STDOUT_FILENO 1 /* standard output file descriptor */
231 #define STDERR_FILENO 2 /* standard error file descriptor */
234 * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
236 * NOTE: Table 4-2, Configurable System Variables, p. 96
239 #define _SC_ARG_MAX 0
240 #define _SC_CHILD_MAX 1
241 #define _SC_CLK_TCK 2
242 #define _SC_NGROUPS_MAX 3
243 #define _SC_OPEN_MAX 4
244 /* no _SC_STREAM_MAX */
245 #define _SC_JOB_CONTROL 5
246 #define _SC_SAVED_IDS 6
247 #define _SC_VERSION 7
248 #define _SC_PAGESIZE 8
249 /* CYGWIN-specific values .. do not touch */
250 #define _SC_NPROCESSORS_CONF 9
251 #define _SC_NPROCESSORS_ONLN 10
252 #define _SC_PHYS_PAGES 11
253 #define _SC_AVPHYS_PAGES 12
254 /* end of CYGWIN-specific values */
255 #define _SC_MQ_OPEN_MAX 13
256 #define _SC_MQ_PRIO_MAX 14
257 #define _SC_RTSIG_MAX 15
258 #define _SC_SEM_NSEMS_MAX 16
259 #define _SC_SEM_VALUE_MAX 17
260 #define _SC_SIGQUEUE_MAX 18
261 #define _SC_TIMER_MAX 19
262 #define _SC_TZNAME_MAX 20
264 #define _SC_ASYNCHRONOUS_IO 21
266 #define _SC_MAPPED_FILES 23
267 #define _SC_MEMLOCK 24
268 #define _SC_MEMLOCK_RANGE 25
269 #define _SC_MEMORY_PROTECTION 26
270 #define _SC_MESSAGE_PASSING 27
271 #define _SC_PRIORITIZED_IO 28
272 #define _SC_REALTIME_SIGNALS 29
273 #define _SC_SEMAPHORES 30
274 #define _SC_SHARED_MEMORY_OBJECTS 31
275 #define _SC_SYNCHRONIZED_IO 32
276 #define _SC_TIMERS 33
277 #define _SC_AIO_LISTIO_MAX 34
278 #define _SC_AIO_MAX 35
279 #define _SC_AIO_PRIO_DELTA_MAX 36
280 #define _SC_DELAYTIMER_MAX 37
283 * P1003.1c/D10, p. 52 adds the following.
286 #define _SC_THREAD_KEYS_MAX 38
287 #define _SC_THREAD_STACK_MIN 39
288 #define _SC_THREAD_THREADS_MAX 40
289 #define _SC_TTY_NAME_MAX 41
291 #define _SC_THREADS 42
292 #define _SC_THREAD_ATTR_STACKADDR 43
293 #define _SC_THREAD_ATTR_STACKSIZE 44
294 #define _SC_THREAD_PRIORITY_SCHEDULING 45
295 #define _SC_THREAD_PRIO_INHERIT 46
296 /* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
297 #define _SC_THREAD_PRIO_PROTECT 47
298 #define _SC_THREAD_PRIO_CEILING _SC_THREAD_PRIO_PROTECT
299 #define _SC_THREAD_PROCESS_SHARED 48
300 #define _SC_THREAD_SAFE_FUNCTIONS 49
301 #define _SC_GETGR_R_SIZE_MAX 50
302 #define _SC_GETPW_R_SIZE_MAX 51
303 #define _SC_LOGIN_NAME_MAX 52
304 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
306 #if !defined(__CYGWIN__) && !defined(__rtems__)
307 #define _SC_STREAM_MAX 100
308 #define _SC_PRIORITY_SCHEDULING 101
311 # define _PC_LINK_MAX 0
312 # define _PC_MAX_CANON 1
313 # define _PC_MAX_INPUT 2
314 # define _PC_NAME_MAX 3
315 # define _PC_PATH_MAX 4
316 # define _PC_PIPE_BUF 5
317 # define _PC_CHOWN_RESTRICTED 6
318 # define _PC_NO_TRUNC 7
319 # define _PC_VDISABLE 8
320 # define _PC_ASYNC_IO 9
321 # define _PC_PRIO_IO 10
322 # define _PC_SYNC_IO 11
324 /* Ask for POSIX permission bits support. */
325 # define _PC_POSIX_PERMISSIONS 90
326 /* Ask for full POSIX permission support including uid/gid settings. */
327 # define _PC_POSIX_SECURITY 91
330 /* FIXME: This is temporary until winsup gets sorted out. */
332 #define MAXPATHLEN (260 - 1 /* NUL */)
334 # define MAXPATHLEN 1024
340 #endif /* _SYS_UNISTD_H */