OSDN Git Service

2001-02-08 Edward M. Lee <tailbert@yahoo.com>
[pf3gnuchains/pf3gnuchains4x.git] / newlib / libc / include / sys / unistd.h
1 #ifndef _SYS_UNISTD_H
2 #define _SYS_UNISTD_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <_ansi.h>
9 #include <sys/types.h>
10 #define __need_size_t
11 #define __need_ptrdiff_t
12 #include <stddef.h>
13
14 extern char **environ;
15
16 void    _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn)));
17
18 int     _EXFUN(access,(const char *__path, int __amode ));
19 unsigned  _EXFUN(alarm, (unsigned __secs ));
20 int     _EXFUN(chdir, (const char *__path ));
21 int     _EXFUN(chmod, (const char *__path, mode_t __mode ));
22 int     _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group ));
23 #ifdef __CYGWIN__
24 int     _EXFUN(chroot, (const char *__path ));
25 #endif
26 int     _EXFUN(close, (int __fildes ));
27 char    _EXFUN(*ctermid, (char *__s ));
28 char    _EXFUN(*cuserid, (char *__s ));
29 int     _EXFUN(dup, (int __fildes ));
30 int     _EXFUN(dup2, (int __fildes, int __fildes2 ));
31 int     _EXFUN(execl, (const char *__path, const char *, ... ));
32 int     _EXFUN(execle, (const char *__path, const char *, ... ));
33 int     _EXFUN(execlp, (const char *__file, const char *, ... ));
34 int     _EXFUN(execv, (const char *__path, char * const __argv[] ));
35 int     _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
36 int     _EXFUN(execvp, (const char *__file, char * const __argv[] ));
37 int     _EXFUN(fchmod, (int __fildes, mode_t __mode ));
38 int     _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
39 pid_t   _EXFUN(fork, (void ));
40 long    _EXFUN(fpathconf, (int __fd, int __name ));
41 int     _EXFUN(fsync, (int __fd));
42 char    _EXFUN(*getcwd, (char *__buf, size_t __size ));
43 gid_t   _EXFUN(getegid, (void ));
44 uid_t   _EXFUN(geteuid, (void ));
45 gid_t   _EXFUN(getgid, (void ));
46 int     _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
47 char    _EXFUN(*getlogin, (void ));
48 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
49 int _EXFUN(getlogin_r, (char *name, size_t namesize) );
50 #endif
51 char    _EXFUN(*getpass, (__const char *__prompt));
52 size_t  _EXFUN(getpagesize, (void));
53 pid_t   _EXFUN(getpgid, (pid_t));
54 pid_t   _EXFUN(getpgrp, (void ));
55 pid_t   _EXFUN(getpid, (void ));
56 pid_t   _EXFUN(getppid, (void ));
57 uid_t   _EXFUN(getuid, (void ));
58 #ifdef __CYGWIN__
59 char    _EXFUN(*getwd, (char *__buf ));
60 #endif
61 int     _EXFUN(isatty, (int __fildes ));
62 int     _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
63 int     _EXFUN(link, (const char *__path1, const char *__path2 ));
64 int     _EXFUN(nice, (int __nice_value ));
65 off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
66 long    _EXFUN(pathconf, (const char *__path, int __name ));
67 int     _EXFUN(pause, (void ));
68 int     _EXFUN(pipe, (int __fildes[2] ));
69 /* POSIX 1003.1b-1993 says read() returns ssize_t */
70 #if defined(__rtems__)
71 ssize_t _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
72 #else
73 int     _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
74 #endif
75 int     _EXFUN(rmdir, (const char *__path ));
76 #if defined(__rtems__)
77 void *  _EXFUN(sbrk,  (ptrdiff_t __incr));
78 #else
79 void *  _EXFUN(sbrk,  (size_t __incr));
80 #endif
81 #if defined(__CYGWIN__)
82 int     _EXFUN(setegid, (gid_t __gid ));
83 int     _EXFUN(seteuid, (uid_t __uid ));
84 #endif
85 int     _EXFUN(setgid, (gid_t __gid ));
86 int     _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
87 int     _EXFUN(setpgrp, (void ));
88 pid_t   _EXFUN(setsid, (void ));
89 int     _EXFUN(setuid, (uid_t __uid ));
90 unsigned _EXFUN(sleep, (unsigned int __seconds ));
91 void    _EXFUN(swab, (const void *, void *, ssize_t));
92 long    _EXFUN(sysconf, (int __name ));
93 pid_t   _EXFUN(tcgetpgrp, (int __fildes ));
94 int     _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
95 char    _EXFUN(*ttyname, (int __fildes ));
96 int     _EXFUN(unlink, (const char *__path ));
97 int     _EXFUN(vhangup, (void ));
98 /* POSIX 1003.1b-1993 says write() returns ssize_t */
99 #if defined(__rtems__)
100 ssize_t     _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte ));
101 #else
102 int     _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte ));
103 #endif
104
105 #ifndef        _POSIX_SOURCE
106 pid_t   _EXFUN(vfork, (void ));
107 #endif /* _POSIX_SOURCE */
108
109 /* Provide prototypes for most of the _<systemcall> names that are
110    provided in newlib for some compilers.  */
111 int     _EXFUN(_close, (int __fildes ));
112 pid_t   _EXFUN(_fork, (void ));
113 pid_t   _EXFUN(_getpid, (void ));
114 int     _EXFUN(_link, (const char *__path1, const char *__path2 ));
115 off_t   _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence ));
116 int     _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte ));
117 void *  _EXFUN(_sbrk,  (size_t __incr));
118 int     _EXFUN(_unlink, (const char *__path ));
119 int     _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte ));
120 int     _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
121
122 #if defined(__CYGWIN__) || defined(__rtems__)
123 int     _EXFUN(getdtablesize, (void));
124 int     _EXFUN(setdtablesize, (int));
125 unsigned _EXFUN(usleep, (unsigned int __useconds));
126 int     _EXFUN(ftruncate, (int __fd, off_t __length));
127 int     _EXFUN(truncate, (const char *, off_t __length));
128 int     _EXFUN(gethostname, (char *__name, size_t __len));
129 char *  _EXFUN(mktemp, (char *));
130 int     _EXFUN(sync, (void));
131 int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
132 int     _EXFUN(symlink, (const char *__name1, const char *__name2));
133 #endif
134
135 # define        F_OK    0
136 # define        R_OK    4
137 # define        W_OK    2
138 # define        X_OK    1
139
140 # define        SEEK_SET        0
141 # define        SEEK_CUR        1
142 # define        SEEK_END        2
143
144 #include <sys/features.h>
145
146 #define STDIN_FILENO    0       /* standard input file descriptor */
147 #define STDOUT_FILENO   1       /* standard output file descriptor */
148 #define STDERR_FILENO   2       /* standard error file descriptor */
149
150 /*
151  *  4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
152  *
153  *  NOTE: Table 4-2, Configurable System Variables, p. 96
154  */
155
156 #define _SC_ARG_MAX                 0
157 #define _SC_CHILD_MAX               1
158 #define _SC_CLK_TCK                 2
159 #define _SC_NGROUPS_MAX             3
160 #define _SC_OPEN_MAX                4
161   /* no _SC_STREAM_MAX */
162 #define _SC_JOB_CONTROL             5
163 #define _SC_SAVED_IDS               6
164 #define _SC_VERSION                 7
165 #define _SC_PAGESIZE                8
166 /* CYGWIN-specific values .. do not touch */
167 #define _SC_NPROCESSORS_CONF        9
168 #define _SC_NPROCESSORS_ONLN       10
169 #define _SC_PHYS_PAGES             11
170 #define _SC_AVPHYS_PAGES           12
171 /* end of CYGWIN-specific values */
172 #define _SC_MQ_OPEN_MAX            13
173 #define _SC_MQ_PRIO_MAX            14
174 #define _SC_RTSIG_MAX              15
175 #define _SC_SEM_NSEMS_MAX          16
176 #define _SC_SEM_VALUE_MAX          17
177 #define _SC_SIGQUEUE_MAX           18
178 #define _SC_TIMER_MAX              19
179 #define _SC_TZNAME_MAX             20
180
181 #define _SC_ASYNCHRONOUS_IO        21
182 #define _SC_FSYNC                  22
183 #define _SC_MAPPED_FILES           23
184 #define _SC_MEMLOCK                24
185 #define _SC_MEMLOCK_RANGE          25
186 #define _SC_MEMORY_PROTECTION      26
187 #define _SC_MESSAGE_PASSING        27
188 #define _SC_PRIORITIZED_IO         28
189 #define _SC_REALTIME_SIGNALS       29
190 #define _SC_SEMAPHORES             30
191 #define _SC_SHARED_MEMORY_OBJECTS  31
192 #define _SC_SYNCHRONIZED_IO        32
193 #define _SC_TIMERS                 33
194 #define _SC_AIO_LISTIO_MAX         34
195 #define _SC_AIO_MAX                35
196 #define _SC_AIO_PRIO_DELTA_MAX     36
197 #define _SC_DELAYTIMER_MAX         37
198
199 /*
200  *  P1003.1c/D10, p. 52 adds the following.
201  */
202
203 #define _SC_THREAD_KEYS_MAX              38
204 #define _SC_THREAD_STACK_MIN             39
205 #define _SC_THREAD_THREADS_MAX           40
206 #define _SC_TTY_NAME_MAX                 41
207
208 #define _SC_THREADS                      42
209 #define _SC_THREAD_ATTR_STACKADDR        43
210 #define _SC_THREAD_ATTR_STACKSIZE        44
211 #define _SC_THREAD_PRIORITY_SCHEDULING   45
212 #define _SC_THREAD_PRIO_INHERIT          46
213 /* _SC_THREAD_PRIO_PROTECT was _SC_THREAD_PRIO_CEILING in early drafts */
214 #define _SC_THREAD_PRIO_PROTECT          47
215 #define _SC_THREAD_PRIO_CEILING          _SC_THREAD_PRIO_PROTECT
216 #define _SC_THREAD_PROCESS_SHARED        48
217 #define _SC_THREAD_SAFE_FUNCTIONS        49
218 #define _SC_GETGR_R_SIZE_MAX             50
219 #define _SC_GETPW_R_SIZE_MAX             51
220 #define _SC_LOGIN_NAME_MAX               52
221 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
222   
223 # define        _PC_LINK_MAX            0
224 # define        _PC_MAX_CANON           1
225 # define        _PC_MAX_INPUT           2
226 # define        _PC_NAME_MAX            3
227 # define        _PC_PATH_MAX            4
228 # define        _PC_PIPE_BUF            5
229 # define        _PC_CHOWN_RESTRICTED    6
230 # define        _PC_NO_TRUNC            7
231 # define        _PC_VDISABLE            8
232 # define        _PC_ASYNC_IO            9
233 # define        _PC_PRIO_IO            10
234 # define        _PC_SYNC_IO            11
235
236 /* FIXME: This is temporary until winsup gets sorted out.  */
237 #ifdef __CYGWIN__
238 #define MAXPATHLEN (260 - 1 /* NUL */)
239 #else
240 # define        MAXPATHLEN      1024
241 #endif
242
243 #ifdef __cplusplus
244 }
245 #endif
246 #endif /* _SYS_UNISTD_H */