mirror of
https://git.proxmox.com/git/wasi-libc
synced 2025-07-15 05:28:17 +00:00

* Make __wasi_linkcount_t a uint64_t (#134) Refs: https://github.com/WebAssembly/WASI/pull/127 * Generate the WASI interface from witx. This replaces the hand-maintained <wasi/core.h> header with a <wasi/api.h> generated from witx. Most of the churn here is caused by upstream WASI renamings; hopefully in the future ABI updates will be less noisy.
15 lines
425 B
C
15 lines
425 B
C
#include <wasi/api.h>
|
|
#include <errno.h>
|
|
|
|
off_t __wasilibc_tell(int fildes) {
|
|
__wasi_filesize_t offset;
|
|
__wasi_errno_t error = __wasi_fd_tell(fildes, &offset);
|
|
if (error != 0) {
|
|
// lseek returns ESPIPE on when called on a pipe, socket, or fifo,
|
|
// which on WASI would translate into ENOTCAPABLE.
|
|
errno = error == ENOTCAPABLE ? ESPIPE : error;
|
|
return -1;
|
|
}
|
|
return offset;
|
|
}
|