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