]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/include/unistd.h
10 #define STDIN_FILENO 0
11 #define STDOUT_FILENO 1
12 #define STDERR_FILENO 2
14 #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
19 #include <__header_unistd.h>
22 #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */
26 #define NULL ((void*)0)
34 #define __NEED_ssize_t
39 #define __NEED_intptr_t
40 #define __NEED_useconds_t
42 #include <bits/alltypes.h>
44 #ifdef __wasilibc_unmodified_upstream /* WASI has no pipe */
46 int pipe2(int [2], int);
49 int posix_close(int, int);
50 #ifdef __wasilibc_unmodified_upstream /* WASI has no dup */
53 int dup3(int, int, int);
55 off_t
lseek(int, off_t
, int);
59 ssize_t
read(int, void *, size_t);
60 ssize_t
write(int, const void *, size_t);
61 ssize_t
pread(int, void *, size_t, off_t
);
62 ssize_t
pwrite(int, const void *, size_t, off_t
);
64 #ifdef __wasilibc_unmodified_upstream /* WASI has no chown */
65 int chown(const char *, uid_t
, gid_t
);
66 int fchown(int, uid_t
, gid_t
);
67 int lchown(const char *, uid_t
, gid_t
);
68 int fchownat(int, const char *, uid_t
, gid_t
, int);
71 int link(const char *, const char *);
72 int linkat(int, const char *, int, const char *, int);
73 int symlink(const char *, const char *);
74 int symlinkat(const char *, int, const char *);
75 ssize_t
readlink(const char *__restrict
, char *__restrict
, size_t);
76 ssize_t
readlinkat(int, const char *__restrict
, char *__restrict
, size_t);
77 int unlink(const char *);
78 int unlinkat(int, const char *, int);
79 int rmdir(const char *);
80 int truncate(const char *, off_t
);
81 int ftruncate(int, off_t
);
83 #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
90 int access(const char *, int);
91 int faccessat(int, const char *, int, int);
93 #ifdef __wasilibc_unmodified_upstream /* WASI has no cwd */
94 int chdir(const char *);
96 char *getcwd(char *, size_t);
99 #ifdef __wasilibc_unmodified_upstream /* WASI has no signals */
100 unsigned alarm(unsigned);
102 unsigned sleep(unsigned);
105 #ifdef __wasilibc_unmodified_upstream /* WASI has no fork/exec */
107 int execve(const char *, char *const [], char *const []);
108 int execv(const char *, char *const []);
109 int execle(const char *, const char *, ...);
110 int execl(const char *, const char *, ...);
111 int execvp(const char *, char *const []);
112 int execlp(const char *, const char *, ...);
113 int fexecve(int, char *const [], char *const []);
115 _Noreturn
void _exit(int);
117 #ifdef __wasilibc_unmodified_upstream /* WASI has no getpid etc. */
121 pid_t
getpgid(pid_t
);
122 int setpgid(pid_t
, pid_t
);
126 #ifdef __wasilibc_unmodified_upstream /* WASI has no ttyname */
128 int ttyname_r(int, char *, size_t);
131 #ifdef __wasilibc_unmodified_upstream /* WASI has no process groups */
132 pid_t
tcgetpgrp(int);
133 int tcsetpgrp(int, pid_t
);
136 #ifdef __wasilibc_unmodified_upstream /* WASI has no getuid etc. */
141 int getgroups(int, gid_t
[]);
148 char *getlogin(void);
149 int getlogin_r(char *, size_t);
150 int gethostname(char *, size_t);
151 char *ctermid(char *);
153 int getopt(int, char * const [], const char *);
155 extern int optind
, opterr
, optopt
;
157 long pathconf(const char *, int);
158 long fpathconf(int, int);
160 size_t confstr(int, char *, size_t);
162 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
167 #ifdef __wasilibc_unmodified_upstream /* WASI has no setreuid */
168 int setreuid(uid_t
, uid_t
);
169 int setregid(gid_t
, gid_t
);
171 #ifdef __wasilibc_unmodified_upstream /* WASI has no POSIX file locking */
172 int lockf(int, int, off_t
);
174 long gethostid(void);
175 #ifdef __wasilibc_unmodified_upstream /* WASI has no nice, sync, or setpgrp */
180 char *crypt(const char *, const char *);
181 void encrypt(char *, int);
182 void swab(const void *__restrict
, void *__restrict
, ssize_t
);
185 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
186 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
187 int usleep(unsigned);
188 unsigned ualarm(unsigned, unsigned);
191 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
195 #ifdef __wasilibc_unmodified_upstream /* WASI has no brk */
198 void *sbrk(intptr_t);
199 #ifdef __wasilibc_unmodified_upstream /* WASI has no processes */
202 int chroot(const char *);
203 int getpagesize(void);
204 int getdtablesize(void);
205 int sethostname(const char *, size_t);
206 int getdomainname(char *, size_t);
207 int setdomainname(const char *, size_t);
208 int setgroups(size_t, const gid_t
*);
209 char *getpass(const char *);
210 int daemon(int, int);
211 void setusershell(void);
212 void endusershell(void);
213 char *getusershell(void);
214 int acct(const char *);
215 long syscall(long, ...);
216 int execvpe(const char *, char *const [], char *const []);
219 int getentropy(void *, size_t);
223 extern char **environ
;
224 #ifdef __wasilibc_unmodified_upstream /* WASI has no get/setresuid */
225 int setresuid(uid_t
, uid_t
, uid_t
);
226 int setresgid(gid_t
, gid_t
, gid_t
);
227 int getresuid(uid_t
*, uid_t
*, uid_t
*);
228 int getresgid(gid_t
*, gid_t
*, gid_t
*);
230 #ifdef __wasilibc_unmodified_upstream /* WASI has no cwd */
231 char *get_current_dir_name(void);
233 #ifdef __wasilibc_unmodified_upstream /* WASI has no syncfs */
236 #ifdef __wasilibc_unmodified_upstream /* WASI has no eaccess */
237 int euidaccess(const char *, int);
238 int eaccess(const char *, int);
242 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
243 #define lseek64 lseek
244 #define pread64 pread
245 #define pwrite64 pwrite
246 #define truncate64 truncate
247 #define ftruncate64 ftruncate
248 #define lockf64 lockf
249 #define off64_t off_t
252 #define POSIX_CLOSE_RESTART 0
254 #define _XOPEN_VERSION 700
255 #define _XOPEN_UNIX 1
256 #define _XOPEN_ENH_I18N 1
258 #define _POSIX_VERSION 200809L
259 #define _POSIX2_VERSION _POSIX_VERSION
261 #define _POSIX_ADVISORY_INFO _POSIX_VERSION
262 #define _POSIX_CHOWN_RESTRICTED 1
263 #define _POSIX_IPV6 _POSIX_VERSION
264 #ifdef __wasilibc_unmodified_upstream /* WASI has no processes, mmap, or mq */
265 #define _POSIX_JOB_CONTROL 1
266 #define _POSIX_MAPPED_FILES _POSIX_VERSION
267 #define _POSIX_MEMLOCK _POSIX_VERSION
268 #define _POSIX_MEMLOCK_RANGE _POSIX_VERSION
269 #define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
270 #define _POSIX_MESSAGE_PASSING _POSIX_VERSION
272 #define _POSIX_FSYNC _POSIX_VERSION
273 #define _POSIX_NO_TRUNC 1
274 #ifdef __wasilibc_unmodified_upstream /* WASI has no raw sockets */
275 #define _POSIX_RAW_SOCKETS _POSIX_VERSION
277 #define _POSIX_REALTIME_SIGNALS _POSIX_VERSION
278 #define _POSIX_REGEXP 1
279 #ifdef __wasilibc_unmodified_upstream /* WASI has no processes */
280 #define _POSIX_SAVED_IDS 1
281 #define _POSIX_SHELL 1
282 #define _POSIX_SPAWN _POSIX_VERSION
284 #define _POSIX_VDISABLE 0
286 #define _POSIX_THREADS _POSIX_VERSION
287 #define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
288 #define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
289 #define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
290 #define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
291 #define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
292 #define _POSIX_THREAD_CPUTIME _POSIX_VERSION
293 #define _POSIX_TIMERS _POSIX_VERSION
294 #define _POSIX_TIMEOUTS _POSIX_VERSION
295 #define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION
296 #define _POSIX_CPUTIME _POSIX_VERSION
297 #define _POSIX_CLOCK_SELECTION _POSIX_VERSION
298 #define _POSIX_BARRIERS _POSIX_VERSION
299 #define _POSIX_SPIN_LOCKS _POSIX_VERSION
300 #define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
301 #ifdef __wasilibc_unmodified_upstream /* WASI has no POSIX async I/O, semaphores, or shared memory */
302 #define _POSIX_ASYNCHRONOUS_IO _POSIX_VERSION
303 #define _POSIX_SEMAPHORES _POSIX_VERSION
304 #define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
307 #define _POSIX2_C_BIND _POSIX_VERSION
309 #include <bits/posix.h>
313 #define _PC_LINK_MAX 0
314 #define _PC_MAX_CANON 1
315 #define _PC_MAX_INPUT 2
316 #define _PC_NAME_MAX 3
317 #define _PC_PATH_MAX 4
318 #define _PC_PIPE_BUF 5
319 #define _PC_CHOWN_RESTRICTED 6
320 #define _PC_NO_TRUNC 7
321 #define _PC_VDISABLE 8
322 #define _PC_SYNC_IO 9
323 #define _PC_ASYNC_IO 10
324 #define _PC_PRIO_IO 11
325 #define _PC_SOCK_MAXBUF 12
326 #define _PC_FILESIZEBITS 13
327 #define _PC_REC_INCR_XFER_SIZE 14
328 #define _PC_REC_MAX_XFER_SIZE 15
329 #define _PC_REC_MIN_XFER_SIZE 16
330 #define _PC_REC_XFER_ALIGN 17
331 #define _PC_ALLOC_SIZE_MIN 18
332 #define _PC_SYMLINK_MAX 19
333 #define _PC_2_SYMLINKS 20
335 #define _SC_ARG_MAX 0
336 #define _SC_CHILD_MAX 1
337 #define _SC_CLK_TCK 2
338 #define _SC_NGROUPS_MAX 3
339 #define _SC_OPEN_MAX 4
340 #define _SC_STREAM_MAX 5
341 #define _SC_TZNAME_MAX 6
342 #define _SC_JOB_CONTROL 7
343 #define _SC_SAVED_IDS 8
344 #define _SC_REALTIME_SIGNALS 9
345 #define _SC_PRIORITY_SCHEDULING 10
346 #define _SC_TIMERS 11
347 #define _SC_ASYNCHRONOUS_IO 12
348 #define _SC_PRIORITIZED_IO 13
349 #define _SC_SYNCHRONIZED_IO 14
351 #define _SC_MAPPED_FILES 16
352 #define _SC_MEMLOCK 17
353 #define _SC_MEMLOCK_RANGE 18
354 #define _SC_MEMORY_PROTECTION 19
355 #define _SC_MESSAGE_PASSING 20
356 #define _SC_SEMAPHORES 21
357 #define _SC_SHARED_MEMORY_OBJECTS 22
358 #define _SC_AIO_LISTIO_MAX 23
359 #define _SC_AIO_MAX 24
360 #define _SC_AIO_PRIO_DELTA_MAX 25
361 #define _SC_DELAYTIMER_MAX 26
362 #define _SC_MQ_OPEN_MAX 27
363 #define _SC_MQ_PRIO_MAX 28
364 #define _SC_VERSION 29
365 #define _SC_PAGE_SIZE 30
366 #define _SC_PAGESIZE 30 /* !! */
367 #define _SC_RTSIG_MAX 31
368 #define _SC_SEM_NSEMS_MAX 32
369 #define _SC_SEM_VALUE_MAX 33
370 #define _SC_SIGQUEUE_MAX 34
371 #define _SC_TIMER_MAX 35
372 #define _SC_BC_BASE_MAX 36
373 #define _SC_BC_DIM_MAX 37
374 #define _SC_BC_SCALE_MAX 38
375 #define _SC_BC_STRING_MAX 39
376 #define _SC_COLL_WEIGHTS_MAX 40
377 #define _SC_EXPR_NEST_MAX 42
378 #define _SC_LINE_MAX 43
379 #define _SC_RE_DUP_MAX 44
380 #define _SC_2_VERSION 46
381 #define _SC_2_C_BIND 47
382 #define _SC_2_C_DEV 48
383 #define _SC_2_FORT_DEV 49
384 #define _SC_2_FORT_RUN 50
385 #define _SC_2_SW_DEV 51
386 #define _SC_2_LOCALEDEF 52
387 #define _SC_UIO_MAXIOV 60 /* !! */
388 #define _SC_IOV_MAX 60
389 #define _SC_THREADS 67
390 #define _SC_THREAD_SAFE_FUNCTIONS 68
391 #define _SC_GETGR_R_SIZE_MAX 69
392 #define _SC_GETPW_R_SIZE_MAX 70
393 #define _SC_LOGIN_NAME_MAX 71
394 #define _SC_TTY_NAME_MAX 72
395 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 73
396 #define _SC_THREAD_KEYS_MAX 74
397 #define _SC_THREAD_STACK_MIN 75
398 #define _SC_THREAD_THREADS_MAX 76
399 #define _SC_THREAD_ATTR_STACKADDR 77
400 #define _SC_THREAD_ATTR_STACKSIZE 78
401 #define _SC_THREAD_PRIORITY_SCHEDULING 79
402 #define _SC_THREAD_PRIO_INHERIT 80
403 #define _SC_THREAD_PRIO_PROTECT 81
404 #define _SC_THREAD_PROCESS_SHARED 82
405 #define _SC_NPROCESSORS_CONF 83
406 #define _SC_NPROCESSORS_ONLN 84
407 #define _SC_PHYS_PAGES 85
408 #define _SC_AVPHYS_PAGES 86
409 #define _SC_ATEXIT_MAX 87
410 #define _SC_PASS_MAX 88
411 #define _SC_XOPEN_VERSION 89
412 #define _SC_XOPEN_XCU_VERSION 90
413 #define _SC_XOPEN_UNIX 91
414 #define _SC_XOPEN_CRYPT 92
415 #define _SC_XOPEN_ENH_I18N 93
416 #define _SC_XOPEN_SHM 94
417 #define _SC_2_CHAR_TERM 95
419 #define _SC_XOPEN_XPG2 98
420 #define _SC_XOPEN_XPG3 99
421 #define _SC_XOPEN_XPG4 100
422 #define _SC_NZERO 109
423 #define _SC_XBS5_ILP32_OFF32 125
424 #define _SC_XBS5_ILP32_OFFBIG 126
425 #define _SC_XBS5_LP64_OFF64 127
426 #define _SC_XBS5_LPBIG_OFFBIG 128
427 #define _SC_XOPEN_LEGACY 129
428 #define _SC_XOPEN_REALTIME 130
429 #define _SC_XOPEN_REALTIME_THREADS 131
430 #define _SC_ADVISORY_INFO 132
431 #define _SC_BARRIERS 133
432 #define _SC_CLOCK_SELECTION 137
433 #define _SC_CPUTIME 138
434 #define _SC_THREAD_CPUTIME 139
435 #define _SC_MONOTONIC_CLOCK 149
436 #define _SC_READER_WRITER_LOCKS 153
437 #define _SC_SPIN_LOCKS 154
438 #define _SC_REGEXP 155
439 #define _SC_SHELL 157
440 #define _SC_SPAWN 159
441 #define _SC_SPORADIC_SERVER 160
442 #define _SC_THREAD_SPORADIC_SERVER 161
443 #define _SC_TIMEOUTS 164
444 #define _SC_TYPED_MEMORY_OBJECTS 165
445 #define _SC_2_PBS 168
446 #define _SC_2_PBS_ACCOUNTING 169
447 #define _SC_2_PBS_LOCATE 170
448 #define _SC_2_PBS_MESSAGE 171
449 #define _SC_2_PBS_TRACK 172
450 #define _SC_SYMLOOP_MAX 173
451 #define _SC_STREAMS 174
452 #define _SC_2_PBS_CHECKPOINT 175
453 #define _SC_V6_ILP32_OFF32 176
454 #define _SC_V6_ILP32_OFFBIG 177
455 #define _SC_V6_LP64_OFF64 178
456 #define _SC_V6_LPBIG_OFFBIG 179
457 #define _SC_HOST_NAME_MAX 180
458 #define _SC_TRACE 181
459 #define _SC_TRACE_EVENT_FILTER 182
460 #define _SC_TRACE_INHERIT 183
461 #define _SC_TRACE_LOG 184
464 #define _SC_RAW_SOCKETS 236
465 #define _SC_V7_ILP32_OFF32 237
466 #define _SC_V7_ILP32_OFFBIG 238
467 #define _SC_V7_LP64_OFF64 239
468 #define _SC_V7_LPBIG_OFFBIG 240
469 #define _SC_SS_REPL_MAX 241
470 #define _SC_TRACE_EVENT_NAME_MAX 242
471 #define _SC_TRACE_NAME_MAX 243
472 #define _SC_TRACE_SYS_MAX 244
473 #define _SC_TRACE_USER_EVENT_MAX 245
474 #define _SC_XOPEN_STREAMS 246
475 #define _SC_THREAD_ROBUST_PRIO_INHERIT 247
476 #define _SC_THREAD_ROBUST_PRIO_PROTECT 248
479 #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1
480 #define _CS_GNU_LIBC_VERSION 2
481 #define _CS_GNU_LIBPTHREAD_VERSION 3
482 #define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 4
483 #define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5
485 #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 1116
486 #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 1117
487 #define _CS_POSIX_V6_ILP32_OFF32_LIBS 1118
488 #define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 1119
489 #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 1120
490 #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 1121
491 #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 1122
492 #define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 1123
493 #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 1124
494 #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 1125
495 #define _CS_POSIX_V6_LP64_OFF64_LIBS 1126
496 #define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS 1127
497 #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 1128
498 #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 1129
499 #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 1130
500 #define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 1131
501 #define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1132
502 #define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 1133
503 #define _CS_POSIX_V7_ILP32_OFF32_LIBS 1134
504 #define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS 1135
505 #define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 1136
506 #define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 1137
507 #define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 1138
508 #define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS 1139
509 #define _CS_POSIX_V7_LP64_OFF64_CFLAGS 1140
510 #define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 1141
511 #define _CS_POSIX_V7_LP64_OFF64_LIBS 1142
512 #define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS 1143
513 #define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 1144
514 #define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145
515 #define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146
516 #define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
517 #define _CS_V6_ENV 1148
518 #define _CS_V7_ENV 1149