New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasi: add wasi sock_accept stub #46434
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
Refs: nodejs/uvwasi#185 Add stub for sock_accept so that we have stubs for all of the sock methods in wasi_snapshot_preview1. Its a bit awkward as the method was added after the initial definitial of wasi_snapshot-preview1 but I think it should be semver minor at most to add the method. Depends on nodejs/uvwasi#185 being landed in uvwasi first and an updated version of uvwasi that includes that being pulled into Node.js Signed-off-by: Michael Dawson <mdawson@devrus.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor comments.
| @@ -1234,6 +1234,21 @@ uint32_t WASI::SockShutdown(WASI& wasi, | |||
| return uvwasi_sock_shutdown(&wasi.uvw_, sock, how); | |||
| } | |||
|
|
|||
| uint32_t WASI::SockAccept(WASI& wasi, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the WASI functions are sorted alphabetically in this file. Can you move this?
| @@ -1306,6 +1321,7 @@ static void Initialize(Local<Object> target, | |||
| V(SockRecv, "sock_recv") | |||
| V(SockSend, "sock_send") | |||
| V(SockShutdown, "sock_shutdown") | |||
| V(SockAccept, "sock_accept") | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about sorting here.
| @@ -142,6 +142,7 @@ class WASI : public BaseObject, | |||
| static uint32_t SockSend( | |||
| WASI&, WasmMemory, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); | |||
| static uint32_t SockShutdown(WASI&, WasmMemory, uint32_t, uint32_t); | |||
| static uint32_t SockAccept(WASI&, WasmMemory, uint32_t, uint32_t, uint32_t); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about sorting.
| int flags = 0; | ||
| int ret = accept(0, NULL, &addrlen); | ||
| assert(ret == -1); | ||
| assert(errno == 58); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to compare against error codes here. [example]
| #include <stdio.h> | ||
|
|
||
| int main(void) { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this file will need to be updated when there is a full implementation of sock_accept(), could you leave a TODO comment.
Nit: blank line.
Refs: nodejs/uvwasi#185
Add stub for sock_accept so that we have stubs
for all of the sock methods in wasi_snapshot_preview1.
Its a bit awkward as the method was added after the
initial definitial of wasi_snapshot-preview1 but I
think it should be semver minor at most to add
the method.
Depends on nodejs/uvwasi#185
being landed in uvwasi first and an updated version
of uvwasi that includes that being pulled into
Node.js
Signed-off-by: Michael Dawson mdawson@devrus.com