Skip to content

wasi: Move version-independent socket constants to the shared module, and add SOCK_CLOEXEC - #5336

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
ChihweiLHBird:wasi-libc-const-update
Aug 3, 2026
Merged

wasi: Move version-independent socket constants to the shared module, and add SOCK_CLOEXEC#5336
tgross35 merged 1 commit into
rust-lang:mainfrom
ChihweiLHBird:wasi-libc-const-update

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Add SOCK_CLOEXEC and move SOCK_NONBLOCK, SOL_SOCKET, SO_TYPE from the wasi-p2 module to the shared wasi module.

In wasi-libc these are defined unconditionally for all WASI versions, not just wasip2.

Source: https://github.com/WebAssembly/wasi-libc/blob/f3e872871c6fb77db9727a18ab812a1a8f6e85ce/libc-bottom-half/headers/public/__header_sys_socket.h#L57-L62

Checklist

  • Relevant tests in libc-test/semver have been updated
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the standard
    doc comment
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI

Although the items were deleted from p2.rs and added to mod.rs, the public accessible constants for users targeting p2 were never changed, so I believe this can still be stable, but correct me if I'm wrong.

libc/src/wasi/mod.rs

Lines 1180 to 1185 in 63b34a9

cfg_if! {
if #[cfg(not(target_env = "p1"))] {
mod p2;
pub use self::p2::*;
}
}

@rustbot label +stable-nominated

@rustbot rustbot added O-wasi stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 28, 2026
@ChihweiLHBird ChihweiLHBird changed the title wasi: move version-independent socket constants to the shared module, and add SOCK_CLOEXEC wasi: Move version-independent socket constants to the shared module, and add SOCK_CLOEXEC Jul 28, 2026
@ChihweiLHBird
ChihweiLHBird force-pushed the wasi-libc-const-update branch from 16e2741 to 9b3a8b7 Compare July 28, 2026 04:06
@ChihweiLHBird
ChihweiLHBird marked this pull request as ready for review July 28, 2026 04:09
@ChihweiLHBird

Copy link
Copy Markdown
Contributor Author

Not sure why the CI failed. Seems to be unrelated to me

@tgross35

tgross35 commented Aug 2, 2026

Copy link
Copy Markdown
Member

@alexcrichton could you take a look?

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35
tgross35 added this pull request to the merge queue Aug 3, 2026
Merged via the queue into rust-lang:main with commit 7518e54 Aug 3, 2026
79 of 81 checks passed
@ChihweiLHBird
ChihweiLHBird deleted the wasi-libc-const-update branch August 3, 2026 23:16
@tgross35 tgross35 mentioned this pull request Aug 31, 2026
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 31, 2026
tgross35 pushed a commit to dybucc/libc that referenced this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-wasi stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants