]> git.proxmox.com Git - wasi-libc.git/blame - libc-top-half/musl/src/stdio/__stdio_close.c
Update to musl 1.2.2.
[wasi-libc.git] / libc-top-half / musl / src / stdio / __stdio_close.c
CommitLineData
e5f14be3 1#ifdef __wasilibc_unmodified_upstream // WASI has no syscall
320054e8
DG
2#else
3#include <unistd.h>
4#endif
5#include "stdio_impl.h"
322bd4ff 6#include "aio_impl.h"
320054e8 7
9f0d8e85 8#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
320054e8
DG
9static int dummy(int fd)
10{
11 return fd;
12}
13
14weak_alias(dummy, __aio_close);
9f0d8e85
DG
15#else
16#define __aio_close(fd) (fd)
17#endif
320054e8
DG
18
19int __stdio_close(FILE *f)
20{
e5f14be3 21#ifdef __wasilibc_unmodified_upstream // WASI has no syscall
320054e8
DG
22 return syscall(SYS_close, __aio_close(f->fd));
23#else
24 return close(__aio_close(f->fd));
25#endif
26}