-
Notifications
You must be signed in to change notification settings - Fork 8
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
socket: long options #75
Conversation
Allows SockSetOpt to accept arbitrary values (that are not only int32). Also adds a new "reserved" socket option level.
return Errno(wasi.ENOTSUP) | ||
|
||
default: | ||
val = wasi.StringValue(value) |
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.
Should we have a BytesValue
instead? I feel like StringValue
implies it's UTF-8 but since this is a fallback it could be anything.
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.
Given the level of the stack we're operating at, StringValue
implies that it's a null-terminated string rather than a utf-8 encoded string. BytesValue
to me reads that it may contain a null byte and so length is supplied separately.
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.
At this point of the code we failed to recognized the option and will just pass the bytes as-is to the wasi.System
, so it may contain null bytes?
This patch makes two main changes:
SockSetOpt
.SockSetOpt
andSockGetOpt
to merge option and level into one value.The main goal is to enable extensions of socket options by the implementations of
wasi.System
, without having to teach wasi-go about them.