wasm
This commit is contained in:
parent
47b135aca0
commit
f90881b03d
9824 changed files with 1706556 additions and 114 deletions
2115
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/api.h
Normal file
2115
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/api.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __wasi_libc_busywait_h
|
||||
#define __wasi_libc_busywait_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Enable busywait in futex on current thread.
|
||||
void __wasilibc_enable_futex_busywait_on_current_thread(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef __wasi_libc_environ_h
|
||||
#define __wasi_libc_environ_h
|
||||
|
||||
/// This header file is a WASI-libc-specific interface, and is not needed by
|
||||
/// most programs. Most programs should just use the standard `getenv` and
|
||||
/// related APIs, which take care of all of the details automatically.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// Initialize the global environment variable state. Only needs to be
|
||||
/// called once; most users should call `__wasilibc_ensure_environ` instead.
|
||||
void __wasilibc_initialize_environ(void);
|
||||
|
||||
/// If `__wasilibc_initialize_environ` has not yet been called, call it.
|
||||
void __wasilibc_ensure_environ(void);
|
||||
|
||||
/// De-initialize the global environment variable state, so that subsequent
|
||||
/// calls to `__wasilibc_ensure_environ` call `__wasilibc_initialize_environ`.
|
||||
void __wasilibc_deinitialize_environ(void);
|
||||
|
||||
/// Call `__wasilibc_initialize_environ` only if `environ` and `_environ` are
|
||||
/// referenced in the program.
|
||||
void __wasilibc_maybe_reinitialize_environ_eagerly(void);
|
||||
|
||||
/// Return the value of the `environ` variable. Using `environ` directly
|
||||
/// requires eager initialization of the environment variables. Using this
|
||||
/// function instead of `environ` allows initialization to happen lazily.
|
||||
char **__wasilibc_get_environ(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
#ifndef __wasi_libc_find_relpath_h
|
||||
#define __wasi_libc_find_relpath_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Look up the given `path`, relative to the cwd, in the preopened directory
|
||||
* map. If a suitable entry is found, then the file descriptor for that entry
|
||||
* is returned. Additionally the absolute path of the directory's file
|
||||
* descriptor is returned in `abs_prefix` and the relative portion that needs
|
||||
* to be opened is stored in `*relative_path`.
|
||||
*
|
||||
* The `relative_path` argument must be a pointer to a buffer valid for
|
||||
* `relative_path_len` bytes, and this may be used as storage for the relative
|
||||
* portion of the path being returned through `*relative_path`.
|
||||
*
|
||||
* See documentation on `__wasilibc_find_abspath` for more info about what the
|
||||
* paths look like.
|
||||
*
|
||||
* Returns -1 on failure. Errno is set to either:
|
||||
*
|
||||
* * ENOMEM - failed to allocate memory for internal routines.
|
||||
* * ENOENT - the `path` could not be found relative to any preopened dir.
|
||||
* * ERANGE - the `relative_path` buffer is too small to hold the relative path.
|
||||
*/
|
||||
int __wasilibc_find_relpath(const char *path,
|
||||
const char **__restrict__ abs_prefix,
|
||||
char **relative_path,
|
||||
size_t relative_path_len);
|
||||
|
||||
/**
|
||||
* Look up the given `path`, which is interpreted as absolute, in the preopened
|
||||
* directory map. If a suitable entry is found, then the file descriptor for
|
||||
* that entry is returned. Additionally the relative portion of the path to
|
||||
* where the fd is opened is returned through `relative_path`, the absolute
|
||||
* prefix which was matched is stored to `abs_prefix`, and `relative_path` may
|
||||
* be an interior pointer to the `abspath` string.
|
||||
*
|
||||
* The `abs_prefix` returned string will not contain a leading `/`. Note that
|
||||
* this may be the empty string. Additionally the returned `relative_path` will
|
||||
* not contain a leading `/`. The `relative_path` return will not return an
|
||||
* empty string, it will return `"."` instead if it would otherwise do so.
|
||||
*
|
||||
* Returns -1 on failure. Errno is set to either:
|
||||
*
|
||||
* * ENOMEM - failed to allocate memory for internal routines.
|
||||
* * ENOENT - the `path` could not be found relative to any preopened dir.
|
||||
*/
|
||||
int __wasilibc_find_abspath(const char *abspath,
|
||||
const char **__restrict__ abs_prefix,
|
||||
const char **__restrict__ relative_path);
|
||||
|
||||
/**
|
||||
* Same as `__wasilibc_find_relpath`, except that this function will interpret
|
||||
* `relative` as a malloc'd buffer that will be `realloc`'d to the appropriate
|
||||
* size to contain the relative path.
|
||||
*
|
||||
* Note that this is a weak symbol and if it's not defined you can use
|
||||
* `__wasilibc_find_relpath`. The weak-nature of this symbols means that if it's
|
||||
* not otherwise included in the compilation then `chdir` wasn't used an there's
|
||||
* no need for this symbol.
|
||||
*
|
||||
* See documentation on `__wasilibc_find_relpath` for more information.
|
||||
*/
|
||||
int __wasilibc_find_relpath_alloc(
|
||||
const char *path,
|
||||
const char **abs,
|
||||
char **relative,
|
||||
size_t *relative_len,
|
||||
int can_realloc
|
||||
) __attribute__((__weak__));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef __wasi_libc_nocwd_h
|
||||
#define __wasi_libc_nocwd_h
|
||||
|
||||
/*
|
||||
* In order to support AT_FDCWD, we need to wrap the *at functions to handle
|
||||
* it by calling back into the non-at versions which perform libpreopen
|
||||
* queries. These __wasilibc_nocwd_* forms are the underlying calls which
|
||||
* assume AT_FDCWD has already been resolved.
|
||||
*/
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
#include <__typedef_ssize_t.h>
|
||||
#include <__typedef_mode_t.h>
|
||||
#include <__typedef_DIR.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct timespec;
|
||||
struct stat;
|
||||
struct dirent;
|
||||
|
||||
int __wasilibc_nocwd___wasilibc_unlinkat(int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd___wasilibc_rmdirat(int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_linkat(int, const char *, int, const char *, int)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_symlinkat(const char *, int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
ssize_t __wasilibc_nocwd_readlinkat(int, const char *__restrict, char *__restrict, size_t)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_faccessat(int, const char *, int, int)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_renameat(int, const char *, int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_openat_nomode(int, const char *, int)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_fstatat(int, const char *__restrict, struct stat *__restrict, int)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_mkdirat_nomode(int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_utimensat(int, const char *, const struct timespec [2], int)
|
||||
__attribute__((__warn_unused_result__));
|
||||
DIR *__wasilibc_nocwd_opendirat(int, const char *)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_nocwd_scandirat(int, const char *, struct dirent ***,
|
||||
int (*)(const struct dirent *),
|
||||
int (*)(const struct dirent **, const struct dirent **))
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
86
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/libc.h
Normal file
86
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/libc.h
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
#ifndef __wasi_libc_h
|
||||
#define __wasi_libc_h
|
||||
|
||||
#include <__typedef_off_t.h>
|
||||
#include <__struct_timespec.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#include <wasi/wasip2.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct stat;
|
||||
struct timespec;
|
||||
|
||||
/// Populate libc's preopen tables. This is normally done automatically
|
||||
/// just before it's needed, however if you call `__wasi_fd_renumber` or
|
||||
/// `__wasi_fd_close` directly, and you need the preopens to be accurate
|
||||
/// afterward, you should call this before doing so.
|
||||
void __wasilibc_populate_preopens(void);
|
||||
|
||||
/// Register the given pre-opened file descriptor under the given path.
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
int __wasilibc_register_preopened_fd(filesystem_preopens_own_descriptor_t fd,
|
||||
wasip2_string_t relprefix);
|
||||
#else
|
||||
int __wasilibc_register_preopened_fd(int fd,
|
||||
const char* prefix);
|
||||
#endif
|
||||
|
||||
/// Renumber `fd` to `newfd`; similar to `dup2` but does a move rather than a
|
||||
/// copy.
|
||||
int __wasilibc_fd_renumber(int fd, int newfd)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
/// Like `unlinkat`, but without depending on `__wasi_path_remove_directory`.
|
||||
int __wasilibc_unlinkat(int fd, const char *path)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
/// An `*at` version of rmdir.
|
||||
int __wasilibc_rmdirat(int fd, const char *path)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
/// Like `open`, but without the varargs in the signature.
|
||||
int __wasilibc_open_nomode(const char *path, int oflag);
|
||||
|
||||
/// Like `openat`, but without the varargs in the signature.
|
||||
int __wasilibc_openat_nomode(int fd, const char *path, int oflag);
|
||||
|
||||
/// Return the current file offset. Like `lseek(fd, 0, SEEK_CUR)`, but without
|
||||
/// depending on `lseek`.
|
||||
off_t __wasilibc_tell(int fd)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
/* Non-`at` forms of various `*at` functions. */
|
||||
int __wasilibc_access(const char *pathname, int mode, int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_stat(const char *__restrict pathname, struct stat *__restrict statbuf, int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_utimens(const char *pathname, const struct timespec times[2], int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_link(const char *oldpath, const char *newpath, int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_link_oldat(int olddirfd, const char *oldpath, const char *newpath, int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_link_newat(const char *oldpath, int newdirfd, const char *newpath, int flags)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_rename_oldat(int olddirfd, const char *oldpath, const char *newpath)
|
||||
__attribute__((__warn_unused_result__));
|
||||
int __wasilibc_rename_newat(const char *oldpath, int newdirfd, const char *newpath)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
/// Enable busywait in futex on current thread.
|
||||
void __wasilibc_enable_futex_busywait_on_current_thread(void);
|
||||
|
||||
/// Fill a buffer with random bytes
|
||||
int __wasilibc_random(void* buffer, size_t len)
|
||||
__attribute__((__warn_unused_result__));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
2498
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/wasip2.h
Normal file
2498
binlib/wasi-sysroot-28.0/include/wasm32-wasip1/wasi/wasip2.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue