mirror of https://github.com/WebAssembly/wasi-libc
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
425 B
14 lines
425 B
#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;
|
|
}
|
|
|