1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
3 // SPDX-License-Identifier: BSD-2-Clause
10 static_assert(SEEK_CUR
== __WASI_WHENCE_CUR
, "Value mismatch");
11 static_assert(SEEK_END
== __WASI_WHENCE_END
, "Value mismatch");
12 static_assert(SEEK_SET
== __WASI_WHENCE_SET
, "Value mismatch");
14 #ifdef __wasilibc_unmodified_upstream /* Optimize the readonly case of lseek */
15 off_t
lseek(int fildes
, off_t offset
, int whence
) {
17 off_t (lseek
)(int fildes
, off_t offset
, int whence
) {
19 __wasi_filesize_t new_offset
;
20 __wasi_errno_t error
=
21 __wasi_fd_seek(fildes
, offset
, whence
, &new_offset
);
23 errno
= error
== ENOTCAPABLE
? ESPIPE
: error
;