Skip to content

Commit eef6505

Browse files
committed
add sub for sock_accept
add the stub for sock_accept so that we have stubs for all method in the current version of snapshot 1. sock_accept was added later after snapshot 1 was first documented. Signed-off-by: Michael Dawson <mdawson@devrus.com>
1 parent 6ad5fc9 commit eef6505

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

include/uvwasi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ uvwasi_errno_t uvwasi_sock_send(uvwasi_t* uvwasi,
267267
uvwasi_errno_t uvwasi_sock_shutdown(uvwasi_t* uvwasi,
268268
uvwasi_fd_t sock,
269269
uvwasi_sdflags_t how);
270+
uvwasi_errno_t uvwasi_sock_accept(uvwasi_t* uvwasi,
271+
uvwasi_fd_t sock,
272+
uvwasi_fdflags_t flags,
273+
uvwasi_fd_t* fd);
270274

271275
#ifdef __cplusplus
272276
}

include/wasi_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ typedef uint64_t uvwasi_rights_t; /* Bitfield */
214214
#define UVWASI_RIGHT_PATH_UNLINK_FILE (1 << 26)
215215
#define UVWASI_RIGHT_POLL_FD_READWRITE (1 << 27)
216216
#define UVWASI_RIGHT_SOCK_SHUTDOWN (1 << 28)
217+
#define UVWASI_RIGHT_SOCK_ACCEPT (1 << 29)
217218

218219
typedef uint16_t uvwasi_roflags_t; /* Bitfield */
219220
#define UVWASI_SOCK_RECV_DATA_TRUNCATED (1 << 0)

src/uvwasi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,16 @@ uvwasi_errno_t uvwasi_sock_shutdown(uvwasi_t* uvwasi,
25572557
return UVWASI_ENOTSUP;
25582558
}
25592559

2560+
uvwasi_errno_t uvwasi_sock_accept(uvwasi_t* uvwasi,
2561+
uvwasi_fd_t sock,
2562+
uvwasi_fdflags_t flags,
2563+
uvwasi_fd_t* fd) {
2564+
/* TODO(mhdawson): Waiting to implement, pending
2565+
https://github.com/WebAssembly/WASI/issues/4 */
2566+
UVWASI_DEBUG("uvwasi_sock_accept(uvwasi=%p, unimplemented)\n", uvwasi);
2567+
return UVWASI_ENOTSUP;
2568+
};
2569+
25602570

25612571
const char* uvwasi_embedder_err_code_to_string(uvwasi_errno_t code) {
25622572
switch (code) {

src/wasi_rights.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
UVWASI_RIGHT_PATH_UNLINK_FILE | \
3232
UVWASI_RIGHT_PATH_REMOVE_DIRECTORY | \
3333
UVWASI_RIGHT_POLL_FD_READWRITE | \
34-
UVWASI_RIGHT_SOCK_SHUTDOWN)
34+
UVWASI_RIGHT_SOCK_SHUTDOWN | \
35+
UVWASI_RIGHT_SOCK_ACCEPT)
3536

3637
#define UVWASI__RIGHTS_BLOCK_DEVICE_BASE UVWASI__RIGHTS_ALL
3738
#define UVWASI__RIGHTS_BLOCK_DEVICE_INHERITING UVWASI__RIGHTS_ALL

0 commit comments

Comments
 (0)