wasi-libc/libc-bottom-half/headers/public/wasi/libc.h
Dan Gohman cf366c06d1 Optimize lseek in the tell case.
`lseek(x, 0, SEEK_CUR)` has no effect other than to return the current
file offset. The patch here uses a macro with `__builtin_constant_p` to
recognize this case and rewrite it to a library call that uses `fd_tell`
rather than `fd_seek`, so that programs that don't need actual seeking
don't end up importing `fd_seek`.

This is also the first usage of `__wasi_fd_tell` in WASI libc, so this
adds it to undefined-symbols.txt.
2019-04-30 16:19:05 -07:00

22 lines
431 B
C

#ifndef __wasi_libc_h
#define __wasi_libc_h
#include <__typedef_off_t.h>
#ifdef __cplusplus
extern "C" {
#endif
void __wasilibc_init_preopen(void);
int __wasilibc_register_preopened_fd(int fd, const char *path);
int __wasilibc_fd_renumber(int fd, int newfd);
int __wasilibc_rmfileat(int fd, const char *path);
int __wasilibc_rmdirat(int fd, const char *path);
off_t __wasilibc_tell(int fd);
#ifdef __cplusplus
}
#endif
#endif