diff options
Diffstat (limited to 'libc-top-half/musl/src/stdio/__stdio_close.c')
-rw-r--r-- | libc-top-half/musl/src/stdio/__stdio_close.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/stdio/__stdio_close.c b/libc-top-half/musl/src/stdio/__stdio_close.c new file mode 100644 index 0000000..0d7c91e --- /dev/null +++ b/libc-top-half/musl/src/stdio/__stdio_close.c @@ -0,0 +1,26 @@ +#ifdef __wasilibc_unmodified_upstream // WASI has no syscall +#else +#include <unistd.h> +#endif +#include "stdio_impl.h" +#include "aio_impl.h" + +#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT) +static int dummy(int fd) +{ + return fd; +} + +weak_alias(dummy, __aio_close); +#else +#define __aio_close(fd) (fd) +#endif + +int __stdio_close(FILE *f) +{ +#ifdef __wasilibc_unmodified_upstream // WASI has no syscall + return syscall(SYS_close, __aio_close(f->fd)); +#else + return close(__aio_close(f->fd)); +#endif +} |