OSDN Git Service

* newlib/libc/include/sys/unistd.h: Add prototypes for
[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 #include <stddef.h>
12
13 extern char **environ;
14
15 void    _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn)));
16
17 int     _EXFUN(access,(const char *__path, int __amode ));
18 unsigned  _EXFUN(alarm, (unsigned __secs ));
19 int     _EXFUN(chdir, (const char *__path ));
20 int     _EXFUN(chmod, (const char *__path, mode_t __mode ));
21 int     _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group ));
22 int     _EXFUN(close, (int __fildes ));
23 char    _EXFUN(*ctermid, (char *__s ));
24 char    _EXFUN(*cuserid, (char *__s ));
25 int     _EXFUN(dup, (int __fildes ));
26 int     _EXFUN(dup2, (int __fildes, int __fildes2 ));
27 int     _EXFUN(execl, (const char *__path, const char *, ... ));
28 int     _EXFUN(execle, (const char *__path, const char *, ... ));
29 int     _EXFUN(execlp, (const char *__file, const char *, ... ));
30 int     _EXFUN(execv, (const char *__path, char * const __argv[] ));
31 int     _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
32 int     _EXFUN(execvp, (const char *__file, char * const __argv[] ));
33 int     _EXFUN(fchmod, (int __fildes, mode_t __mode ));
34 int     _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
35 pid_t   _EXFUN(fork, (void ));
36 long    _EXFUN(fpathconf, (int __fd, int __name ));
37 int     _EXFUN(fsync, (int __fd));
38 char    _EXFUN(*getcwd, (char *__buf, size_t __size ));
39 gid_t   _EXFUN(getegid, (void ));
40 uid_t   _EXFUN(geteuid, (void ));
41 gid_t   _EXFUN(getgid, (void ));
42 int     _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
43 char    _EXFUN(*getlogin, (void ));
44 char    _EXFUN(*getpass, (__const char *__prompt));
45 size_t  _EXFUN(getpagesize, (void));
46 pid_t   _EXFUN(getpgrp, (void ));
47 pid_t   _EXFUN(getpid, (void ));
48 pid_t   _EXFUN(getppid, (void ));
49 uid_t   _EXFUN(getuid, (void ));
50 int     _EXFUN(isatty, (int __fildes ));
51 int     _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
52 int     _EXFUN(link, (const char *__path1, const char *__path2 ));
53 int     _EXFUN(nice, (int __nice_value ));
54 off_t   _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
55 long    _EXFUN(pathconf, (const char *__path, int __name ));
56 int     _EXFUN(pause, (void ));
57 int     _EXFUN(pipe, (int __fildes[2] ));
58 int     _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte ));
59 int     _EXFUN(rmdir, (const char *__path ));
60 void *  _EXFUN(sbrk,  (size_t __incr));
61 int     _EXFUN(setgid, (gid_t __gid ));
62 int     _EXFUN(setpgid, (pid_t __pid, pid_t __pgid ));
63 pid_t   _EXFUN(setsid, (void ));
64 int     _EXFUN(setuid, (uid_t __uid ));
65 unsigned _EXFUN(sleep, (unsigned int __seconds ));
66 void    _EXFUN(swab, (const void *, void *, ssize_t));
67 long    _EXFUN(sysconf, (int __name ));
68 pid_t   _EXFUN(tcgetpgrp, (int __fildes ));
69 int     _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id ));
70 char    _EXFUN(*ttyname, (int __fildes ));
71 int     _EXFUN(unlink, (const char *__path ));
72 int     _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte ));
73
74 /* Provide prototypes for most of the _<systemcall> names that are
75    provided in newlib for some compilers.  */
76 int     _EXFUN(_close, (int __fildes ));
77 pid_t   _EXFUN(_fork, (void ));
78 pid_t   _EXFUN(_getpid, (void ));
79 int     _EXFUN(_link, (const char *__path1, const char *__path2 ));
80 off_t   _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence ));
81 int     _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte ));
82 void *  _EXFUN(_sbrk,  (size_t __incr));
83 int     _EXFUN(_unlink, (const char *__path ));
84 int     _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte ));
85
86 #if defined(__CYGWIN32__) || defined(__rtems__)
87 unsigned _EXFUN(usleep, (unsigned int __useconds));
88 int     _EXFUN(ftruncate, (int __fd, off_t __length));
89 int     _EXFUN(truncate, (const char *, off_t __length));
90 int     _EXFUN(gethostname, (char *__name, size_t __len));
91 char *  _EXFUN(mktemp, (char *));
92 int     _EXFUN(sync, (void));
93 int     _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
94 int     _EXFUN(symlink, (const char *__name1, const char *__name2));
95 #endif
96
97 # define        F_OK    0
98 # define        R_OK    4
99 # define        W_OK    2
100 # define        X_OK    1
101
102 # define        SEEK_SET        0
103 # define        SEEK_CUR        1
104 # define        SEEK_END        2
105
106 /*
107  *  RTEMS adheres to a later version of POSIX -- 1003.1b.
108  *
109  *  XXX this version string should change.
110  */
111
112 #ifdef __rtems__
113 #ifndef _POSIX_JOB_CONTROL
114 # define _POSIX_JOB_CONTROL     1
115 #endif
116 #ifndef _POSIX_SAVED_IDS
117 # define _POSIX_SAVED_IDS       1
118 #endif
119 # define _POSIX_VERSION 199009L
120 #else
121 #ifdef __svr4__
122 # define _POSIX_JOB_CONTROL     1
123 # define _POSIX_SAVED_IDS       1
124 # define _POSIX_VERSION 199009L
125 #endif
126 #endif
127
128 #ifdef __CYGWIN32__
129 # define _POSIX_JOB_CONTROL     1
130 # define _POSIX_SAVED_IDS       0
131 # define _POSIX_VERSION         199009L
132 #endif
133
134 #define STDIN_FILENO    0       /* standard input file descriptor */
135 #define STDOUT_FILENO   1       /* standard output file descriptor */
136 #define STDERR_FILENO   2       /* standard error file descriptor */
137
138 long _EXFUN(sysconf, (int __name));
139
140 # define        _SC_ARG_MAX     0
141 # define        _SC_CHILD_MAX   1
142 # define        _SC_CLK_TCK     2
143 # define        _SC_NGROUPS_MAX 3
144 # define        _SC_OPEN_MAX    4
145 /* no _SC_STREAM_MAX */
146 # define        _SC_JOB_CONTROL 5
147 # define        _SC_SAVED_IDS   6
148 # define        _SC_VERSION     7
149 # define        _SC_PAGESIZE    8
150
151 # define        _PC_LINK_MAX    0
152 # define        _PC_MAX_CANON   1
153 # define        _PC_MAX_INPUT   2
154 # define        _PC_NAME_MAX    3
155 # define        _PC_PATH_MAX    4
156 # define        _PC_PIPE_BUF    5
157 # define        _PC_CHOWN_RESTRICTED    6
158 # define        _PC_NO_TRUNC    7
159 # define        _PC_VDISABLE    8
160 # define        _PC_ASYNC_IO    9
161 # define        _PC_PRIO_IO     10
162 # define        _PC_SYNC_IO     11
163
164 # ifndef        _POSIX_SOURCE
165 #  define       MAXNAMLEN       1024
166 # endif         /* _POSIX_SOURCE */
167
168 /* FIXME: This is temporary until winsup gets sorted out.  */
169 #ifdef __CYGWIN32__
170 #define MAXPATHLEN (260 - 1 /* NUL */)
171 #else
172 # define        MAXPATHLEN      1024
173 #endif
174
175 #ifdef __cplusplus
176 }
177 #endif
178 #endif /* _SYS_UNISTD_H */