Debian Codegraph @

libc-top-half/musl/src/stdio/__stdio_close.c

raw
1 #ifdef __wasilibc_unmodified_upstream // WASI has no syscall
2 #else
3 #include <unistd.h>
4 #endif
5 #include "stdio_impl.h"
6 #include "aio_impl.h"
7
8 #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
9 static int dummy(int fd)
10 {
11 return fd;
12 }
13
14 weak_alias(dummy, __aio_close);
15 #else
16 #define __aio_close(fd) (fd)
17 #endif
18
19 int __stdio_close(FILE *f)
20 {
21 #ifdef __wasilibc_unmodified_upstream // WASI has no syscall
22 return syscall(SYS_close, __aio_close(f->fd));
23 #else
24 return close(__aio_close(f->fd));
25 #endif
26 }