Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions expected/wasm32-wasi/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ __wasi_poll_oneoff
__wasi_proc_exit
__wasi_random_get
__wasi_sched_yield
__wasi_sock_accept
__wasi_sock_recv
__wasi_sock_send
__wasi_sock_shutdown
Expand Down
1 change: 1 addition & 0 deletions expected/wasm32-wasi/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2954,6 +2954,7 @@
#define __WASI_RIGHTS_PATH_SYMLINK ((__wasi_rights_t)(1 << 24))
#define __WASI_RIGHTS_PATH_UNLINK_FILE ((__wasi_rights_t)(1 << 26))
#define __WASI_RIGHTS_POLL_FD_READWRITE ((__wasi_rights_t)(1 << 27))
#define __WASI_RIGHTS_SOCK_ACCEPT ((__wasi_rights_t)(1 << 29))
#define __WASI_RIGHTS_SOCK_SHUTDOWN ((__wasi_rights_t)(1 << 28))
#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED ((__wasi_roflags_t)(1 << 0))
#define __WASI_SDFLAGS_RD ((__wasi_sdflags_t)(1 << 0))
Expand Down
1 change: 1 addition & 0 deletions expected/wasm32-wasi/undefined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ __imported_wasi_snapshot_preview1_poll_oneoff
__imported_wasi_snapshot_preview1_proc_exit
__imported_wasi_snapshot_preview1_random_get
__imported_wasi_snapshot_preview1_sched_yield
__imported_wasi_snapshot_preview1_sock_accept
__imported_wasi_snapshot_preview1_sock_recv
__imported_wasi_snapshot_preview1_sock_send
__imported_wasi_snapshot_preview1_sock_shutdown
Expand Down
26 changes: 25 additions & 1 deletion libc-bottom-half/headers/public/wasi/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ typedef uint64_t __wasi_rights_t;
*/
#define __WASI_RIGHTS_SOCK_SHUTDOWN ((__wasi_rights_t)(1 << 28))

/**
* The right to invoke `sock_accept`.
*/
#define __WASI_RIGHTS_SOCK_ACCEPT ((__wasi_rights_t)(1 << 29))

/**
* A file descriptor handle.
*/
Expand Down Expand Up @@ -1394,7 +1399,8 @@ _Static_assert(_Alignof(__wasi_prestat_t) == 4, "witx calculated align");

/**
* 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`.
* Each argument is expected to be `\0` terminated.
*/
__wasi_errno_t __wasi_args_get(
uint8_t * * argv,
Expand All @@ -1413,6 +1419,7 @@ __wasi_errno_t __wasi_args_sizes_get(
/**
* Read environment variable data.
* The sizes of the buffers should match that returned by `environ_sizes_get`.
* Key/value pairs are expected to be joined with `=`s, and terminated with `\0`s.
*/
__wasi_errno_t __wasi_environ_get(
uint8_t * * environ,
Expand Down Expand Up @@ -2005,6 +2012,23 @@ __wasi_errno_t __wasi_random_get(
uint8_t * buf,
__wasi_size_t buf_len
) __attribute__((__warn_unused_result__));
/**
* Accept a new incoming connection.
* Note: This is similar to `accept` in POSIX.
* @return
* New socket connection
*/
__wasi_errno_t __wasi_sock_accept(
/**
* The listening socket.
*/
__wasi_fd_t fd,
/**
* The desired values of the file descriptor flags.
*/
__wasi_fdflags_t flags,
__wasi_fd_t *retptr0
) __attribute__((__warn_unused_result__));
/**
* Receive a message from a socket.
* Note: This is similar to `recv` in POSIX, though it also supports reading
Expand Down
14 changes: 14 additions & 0 deletions libc-bottom-half/sources/__wasilibc_real.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,20 @@ __wasi_errno_t __wasi_random_get(
return (uint16_t) ret;
}

int32_t __imported_wasi_snapshot_preview1_sock_accept(int32_t arg0, int32_t arg1, int32_t arg2) __attribute__((
__import_module__("wasi_snapshot_preview1"),
__import_name__("sock_accept")
));

__wasi_errno_t __wasi_sock_accept(
__wasi_fd_t fd,
__wasi_fdflags_t flags,
__wasi_fd_t *retptr0
){
int32_t ret = __imported_wasi_snapshot_preview1_sock_accept((int32_t) fd, flags, (int32_t) retptr0);
return (uint16_t) ret;
}

int32_t __imported_wasi_snapshot_preview1_sock_recv(int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3, int32_t arg4, int32_t arg5) __attribute__((
__import_module__("wasi_snapshot_preview1"),
__import_name__("sock_recv")
Expand Down
2 changes: 1 addition & 1 deletion tools/wasi-headers/WASI
Submodule WASI updated 77 files
+0 −37 .github/workflows/main.yml
+0 −11 .gitignore
+54 −1 Contributing.md
+86 −0 Proposals.md
+154 −20 README.md
+0 −291 docs/DesignPrinciples.md
+0 −25 docs/HighLevelGoals.md
+0 −37 docs/Process.md
+0 −64 docs/Proposals.md
+0 −15 docs/README.md
+0 −147 docs/WASI-overview.md
+ docs/wasi-software-architecture.png
+5 −0 legacy/README.md
+9 −1 legacy/application-abi.md
+0 −0 legacy/optional-imports.md
+0 −377 meetings/2019/WASI-05-02.md
+0 −291 meetings/2019/WASI-05-16.md
+0 −116 meetings/2019/WASI-05-30.md
+0 −241 meetings/2019/WASI-06-27.md
+0 −262 meetings/2019/WASI-07-18.md
+0 −121 meetings/2019/WASI-08-15.md
+0 −64 meetings/2019/WASI-08-30.md
+0 −92 meetings/2019/WASI-09-12.md
+0 −60 meetings/2019/WASI-09-26.md
+0 −116 meetings/2019/WASI-10-15.md
+0 −171 meetings/2019/WASI-10-24.md
+0 −102 meetings/2019/WASI-11-07.md
+0 −63 meetings/2019/WASI-11-21.md
+0 −124 meetings/2019/WASI-12-05.md
+0 −44 meetings/2019/WASI-12-19.md
+ meetings/2019/What HTTP Needs from WebAssembly.pdf
+0 −123 meetings/2020/WASI-01-16.md
+0 −92 meetings/2020/WASI-02-27.md
+0 −85 meetings/2020/WASI-03-12.md
+0 −126 meetings/2020/WASI-03-26.md
+0 −83 meetings/2020/WASI-04-09.md
+0 −89 meetings/2020/WASI-05-07.md
+0 −99 meetings/2020/WASI-05-21.md
+0 −43 meetings/2020/WASI-06-04.md
+0 −41 meetings/2020/WASI-07-02.md
+0 −41 meetings/2020/WASI-07-16.md
+0 −36 meetings/2020/WASI-07-30.md
+0 −42 meetings/2020/WASI-08-27.md
+0 −33 meetings/2020/WASI-09-10.md
+0 −30 meetings/2020/WASI-09-24.md
+0 −42 meetings/2020/WASI-10-08.md
+0 −211 meetings/2020/WASI-10-22.md
+0 −153 meetings/2020/WASI-11-19.md
+0 −130 meetings/2020/WASI-12-03.md
+0 −75 meetings/2021/WASI-01-14.md
+0 −206 meetings/2021/WASI-01-28.md
+0 −118 meetings/2021/WASI-02-11.md
+0 −33 meetings/2021/WASI-02-25.md
+0 −50 meetings/README.md
+18 −8 phases/ephemeral/docs.md
+12 −2 phases/ephemeral/witx/typenames.witx
+2 −1 phases/ephemeral/witx/wasi_ephemeral_args.witx
+1 −0 phases/ephemeral/witx/wasi_ephemeral_environ.witx
+6 −3 phases/ephemeral/witx/wasi_ephemeral_proc.witx
+3 −1 phases/old/snapshot_0/docs.md
+3 −1 phases/old/snapshot_0/witx/wasi_unstable.witx
+35 −1 phases/snapshot/docs.md
+2 −0 phases/snapshot/witx/typenames.witx
+14 −1 phases/snapshot/witx/wasi_snapshot_preview1.witx
+0 −4 proposal-template/README.md
+0 −8 proposals/README.md
+0 −5 snapshots/README.md
+0 −159 snapshots/make-snapshot.sh
+0 −12 standard/README.md
+17 −0 tools/repo_docs.sh
+25 −0 tools/witx-cli/Cargo.toml
+110 −17 tools/witx-cli/src/main.rs
+2 −2 tools/witx-docs.md
+2 −5 tools/witx/Cargo.toml
+4 −4 tools/witx/src/io.rs
+32 −0 tools/witx/src/toplevel.rs
+0 −99 tools/witx/tests/wasi-docs.rs