Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/include/wasi/wasi-helpers.h
6171 views
1
/*
2
* Copyright 2019 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef __wasi_emscripten_helpers_h
9
#define __wasi_emscripten_helpers_h
10
11
#include <wasi/api.h>
12
13
#ifdef __cplusplus
14
extern "C" {
15
#endif
16
17
// Converts a wasi return code to a musl syscall return code (-1 if
18
// error, 0 otherwise), and sets errno accordingly.
19
int __wasi_syscall_ret(__wasi_errno_t code);
20
21
// Check if a wasi file descriptor is valid, returning 1 if valid and 0 if
22
// not. If not, also sets errno to EBADF.
23
int __wasi_fd_is_valid(__wasi_fd_t fd);
24
25
struct timespec __wasi_timestamp_to_timespec(__wasi_timestamp_t timestamp);
26
27
#ifdef __cplusplus
28
}
29
#endif
30
31
#endif // __wasi_emscripten_helpers_h
32
33