Move sys/wasi to sys/wasm/wasi

This commit is contained in:
gingerBill
2021-10-31 12:30:10 +00:00
parent 9a5216921c
commit c6e08b059b
@@ -1,7 +1,7 @@
//+build wasm32 //+build wasm32
package sys_wasi package sys_wasi
foreign import "env" foreign import wasi "env"
DIRCOOKIE_START :: u64(0) DIRCOOKIE_START :: u64(0)
size_t :: uint size_t :: uint
@@ -971,7 +971,7 @@ prestat_t :: struct {
} }
@(link_prefix="__wasi_") @(link_prefix="__wasi_")
foreign env { foreign wasi {
/** /**
* Read command-line argument data. * Read command-line argument data.
* The size of the array should match that returned by `args_sizes_get` * The size of the array should match that returned by `args_sizes_get`
@@ -1297,131 +1297,6 @@ foreign env {
) -> errno_t --- ) -> errno_t ---
} }
foreign env {
__wasi_args_sizes_get :: proc(
retptr0: ^size_t,
retptr1: ^size_t,
) -> errno_t ---
__wasi_environ_sizes_get :: proc(
retptr0: ^size_t,
retptr1: ^size_t,
) -> errno_t ---
__wasi_clock_res_get :: proc(
id: clockid_t,
retptr0: ^timestamp_t,
) -> errno_t ---
__wasi_clock_time_get :: proc(
id: clockid_t,
precision: timestamp_t,
retptr0: ^timestamp_t,
) -> errno_t ---
__wasi_fd_fdstat_get :: proc(
fd: fd_t,
retptr0: ^fdstat_t,
) -> errno_t ---
__wasi_fd_filestat_get :: proc(
fd: fd_t,
retptr0: ^filestat_t,
) -> errno_t ---
__wasi_fd_pread :: proc(
fd: fd_t,
iovs: [^]iovec_t,
iovs_len: size_t,
offset: filesize_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_prestat_get :: proc(
fd: fd_t,
retptr0: ^prestat_t,
) -> errno_t ---
__wasi_fd_pwrite :: proc(
fd: fd_t,
iovs: [^]ciovec_t,
iovs_len: size_t,
offset: filesize_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_read :: proc(
fd: fd_t,
iovs: [^]iovec_t,
iovs_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_readdir :: proc(
fd: fd_t,
buf: [^]u8,
buf_len: size_t,
cookie: dircookie_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_seek :: proc(
fd: fd_t,
offset: filedelta_t,
whence: whence_t,
retptr0: ^filesize_t,
) -> errno_t ---
__wasi_fd_tell :: proc(
fd: fd_t,
retptr0: ^filesize_t,
) -> errno_t ---
__wasi_fd_write :: proc(
fd: fd_t,
iovs: [^]ciovec_t,
iovs_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_path_filestat_get :: proc(
fd: fd_t,
flags: lookupflags_t,
/**
* The path of the file or directory to inspect.
*/
path: cstring,
retptr0: ^filestat_t,
) -> errno_t ---
__wasi_path_open :: proc(
fd: fd_t,
dirflags: lookupflags_t,
path: cstring,
oflags: oflags_t,
fs_rights_base: rights_t,
fs_rights_inheriting: rights_t,
fdflags: fdflags_t,
retptr: ^fd_t,
) -> errno_t ---
__wasi_path_readlink :: proc(
fd: fd_t,
path: cstring,
buf: [^]u8,
buf_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_poll_oneoff :: proc(
subscription_in: ^subscription_t,
event_out: ^event_t,
nsubscriptions: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_sock_recv :: proc(
fd: fd_t,
ri_data: [^]iovec_t,
ri_data_len: size_t,
ri_flags: riflags_t,
retptr0: ^size_t,
retptr1: ^roflags_t,
) -> errno_t ---
__wasi_sock_send :: proc(
fd: fd_t,
si_data: [^]ciovec_t,
si_data_len: size_t,
si_flags: siflags_t,
retptr0: ^size_t,
) -> errno_t ---
}
/** /**
* Return command-line argument data sizes. * Return command-line argument data sizes.
* @return * @return
@@ -1817,3 +1692,126 @@ sock_send :: proc(
err = __wasi_sock_send(fd, si_data, si_data_len, si_flags, &n) err = __wasi_sock_send(fd, si_data, si_data_len, si_flags, &n)
return return
} }
foreign wasi {
__wasi_args_sizes_get :: proc(
retptr0: ^size_t,
retptr1: ^size_t,
) -> errno_t ---
__wasi_environ_sizes_get :: proc(
retptr0: ^size_t,
retptr1: ^size_t,
) -> errno_t ---
__wasi_clock_res_get :: proc(
id: clockid_t,
retptr0: ^timestamp_t,
) -> errno_t ---
__wasi_clock_time_get :: proc(
id: clockid_t,
precision: timestamp_t,
retptr0: ^timestamp_t,
) -> errno_t ---
__wasi_fd_fdstat_get :: proc(
fd: fd_t,
retptr0: ^fdstat_t,
) -> errno_t ---
__wasi_fd_filestat_get :: proc(
fd: fd_t,
retptr0: ^filestat_t,
) -> errno_t ---
__wasi_fd_pread :: proc(
fd: fd_t,
iovs: [^]iovec_t,
iovs_len: size_t,
offset: filesize_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_prestat_get :: proc(
fd: fd_t,
retptr0: ^prestat_t,
) -> errno_t ---
__wasi_fd_pwrite :: proc(
fd: fd_t,
iovs: [^]ciovec_t,
iovs_len: size_t,
offset: filesize_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_read :: proc(
fd: fd_t,
iovs: [^]iovec_t,
iovs_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_readdir :: proc(
fd: fd_t,
buf: [^]u8,
buf_len: size_t,
cookie: dircookie_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_fd_seek :: proc(
fd: fd_t,
offset: filedelta_t,
whence: whence_t,
retptr0: ^filesize_t,
) -> errno_t ---
__wasi_fd_tell :: proc(
fd: fd_t,
retptr0: ^filesize_t,
) -> errno_t ---
__wasi_fd_write :: proc(
fd: fd_t,
iovs: [^]ciovec_t,
iovs_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_path_filestat_get :: proc(
fd: fd_t,
flags: lookupflags_t,
/**
* The path of the file or directory to inspect.
*/
path: cstring,
retptr0: ^filestat_t,
) -> errno_t ---
__wasi_path_open :: proc(
fd: fd_t,
dirflags: lookupflags_t,
path: cstring,
oflags: oflags_t,
fs_rights_base: rights_t,
fs_rights_inheriting: rights_t,
fdflags: fdflags_t,
retptr: ^fd_t,
) -> errno_t ---
__wasi_path_readlink :: proc(
fd: fd_t,
path: cstring,
buf: [^]u8,
buf_len: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_poll_oneoff :: proc(
subscription_in: ^subscription_t,
event_out: ^event_t,
nsubscriptions: size_t,
retptr0: ^size_t,
) -> errno_t ---
__wasi_sock_recv :: proc(
fd: fd_t,
ri_data: [^]iovec_t,
ri_data_len: size_t,
ri_flags: riflags_t,
retptr0: ^size_t,
retptr1: ^roflags_t,
) -> errno_t ---
__wasi_sock_send :: proc(
fd: fd_t,
si_data: [^]ciovec_t,
si_data_len: size_t,
si_flags: siflags_t,
retptr0: ^size_t,
) -> errno_t ---
}