Skip to content
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

Merged
merged 5 commits into from
Jun 28, 2023
Merged

socket: long options #75

merged 5 commits into from
Jun 28, 2023

Conversation

pelletier
Copy link
Contributor

This patch makes two main changes:

  • Allow options of variable lengths to be passed through SockSetOpt.
  • Modify SockSetOpt and SockGetOpt 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.

Allows SockSetOpt to accept arbitrary values (that are not only int32). Also
adds a new "reserved" socket option level.
imports/wasi_snapshot_preview1/wasmedge.go Outdated Show resolved Hide resolved
return Errno(wasi.ENOTSUP)

default:
val = wasi.StringValue(value)
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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?

@pelletier pelletier merged commit 255ccea into main Jun 28, 2023
@pelletier pelletier deleted the socksetoptlong branch June 28, 2023 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants