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

Enable socket options definitions #308

Closed
wants to merge 1 commit into from
Closed

Conversation

loganek
Copy link
Contributor

@loganek loganek commented Jul 26, 2022

Fixes #304

@loganek loganek force-pushed the main branch 2 times, most recently from e4ade06 to caf3d7f Compare July 26, 2022 14:19
@sbc100 sbc100 requested a review from sunfishcode July 26, 2022 14:49
@sunfishcode
Copy link
Member

My main question here is whether it's better to define all of these macros, or to selectively define only the ones which WASI is expected to support. For example, let's say something like SO_ATTACH_BPF doesn't happen for the foreseeable future. Is it better for WASI to define it and have it fail at runtime, or to leave it undefined?

@loganek
Copy link
Contributor Author

loganek commented Jul 31, 2022

My main question here is whether it's better to define all of these macros, or to selectively define only the ones which WASI is expected to support. For example, let's say something like SO_ATTACH_BPF doesn't happen for the foreseeable future. Is it better for WASI to define it and have it fail at runtime, or to leave it undefined?

Yeah, I did think about it; on one hand it's better to handle unimplemented properties as early as possible (in that case, at compilation time). On the other hand, that will make porting code to WASM more difficult. This will be especially hard for the code that doesn't use non-supported properties, but e.g. relies on 3rd party dependency that under the hood uses it in some branches that are very unlikely to be hit. Not sure if there's a general guidance or if there were similar situations before - we either prioritize safety and avoid runtime errors (even for properties that aren't likely to be used anyway) or we lean towards ease of porting existing codebase. I'm personally less concerned about runtime errors as this can be handled at the testing stage; at the same time I'm aware of the status of test coverage for multiple projects around... I'm curious to know what are the community thought on that.

@sbc100
Copy link
Member

sbc100 commented Aug 1, 2022

We could always introduce more macros like _WASI_EMULATED_SIGNAL.. perhaps we could have a single one that enables maximum source compatibility, for folks that just want to get something building?

@yamt
Copy link
Contributor

yamt commented Jan 4, 2023

My main question here is whether it's better to define all of these macros, or to selectively define only the ones which WASI is expected to support. For example, let's say something like SO_ATTACH_BPF doesn't happen for the foreseeable future. Is it better for WASI to define it and have it fail at runtime, or to leave it undefined?

Yeah, I did think about it; on one hand it's better to handle unimplemented properties as early as possible (in that case, at compilation time). On the other hand, that will make porting code to WASM more difficult. This will be especially hard for the code that doesn't use non-supported properties, but e.g. relies on 3rd party dependency that under the hood uses it in some branches that are very unlikely to be hit. Not sure if there's a general guidance or if there were similar situations before - we either prioritize safety and avoid runtime errors (even for properties that aren't likely to be used anyway) or we lean towards ease of porting existing codebase. I'm personally less concerned about runtime errors as this can be handled at the testing stage; at the same time I'm aware of the status of test coverage for multiple projects around... I'm curious to know what are the community thought on that.

while i can understand the argument for things like SO_LINGER,
i don't think it makes much sense to have very linux-specific stuff, which is not portable regardless of wasi.

Given there are already AF_* definitions, and they are (now) essentially
synonyms, we add those definitions to enable compilation of code that
already use PF_* macros.
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.

Provide socket option definitions
4 participants