Skip to content

Fill out some more WASI pthread APIs#5310

Open
alexcrichton wants to merge 2 commits into
rust-lang:mainfrom
alexcrichton:add-wasi-pthread-apis
Open

Fill out some more WASI pthread APIs#5310
alexcrichton wants to merge 2 commits into
rust-lang:mainfrom
alexcrichton:add-wasi-pthread-apis

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

Also update wasmtime/wasi-sdk used in testing to keep them up-to-date.

@rustbot label +stable-nominated

@rustbot rustbot added A-CI Area: CI-related items O-wasi S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 22, 2026

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two nits then lgtm!

Is there a way to detect wasi version from headers? Not really needed right now but it would be good to fill out

libc/libc-test/build.rs

Lines 6400 to 6432 in a1fcda2

let src = r#"
#if defined(__linux__) && defined(__has_include)
#if __has_include(<linux/version.h>)
/* Defines LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL (integers) */
#include "linux/version.h"
#endif
#endif
/* Including a libc header will define __GLIBC__ */
#include <stdio.h>
#ifdef __GLIBC__
/* Provides __GLIBC__, __GLIBC_MINOR__ (integers) */
#include "gnu/libc-version.h"
#endif
#if defined(__FreeBSD__) \
|| defined(__NetBSD__) \
|| defined(__OpenBSD__) \
|| defined(__APPLE__)
/* FreeBSD: __FreeBSD_version (MMmmRxx string, e.g. 1600018)
* NetBSD: __NetBSD_Version__ (MMmmrrpp00 string, e.g. 1001000000)
* OpenBSD: OpenBSD (release date, e.g. 202510) and OpenBSDM_m (e.g. OpenBSD7_8)
* Apple: __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_M_m (e.g. __MAC_26_5)
*/
#include "sys/param.h"
#endif
#ifdef __EMSCRIPTEN__
/* Provides __EMSCRIPTEN_MAJOR__, __EMSCRIPTEN_MINOR__ */
#include "emscripten/version.h"
#endif
"#;

View changes since this review

Comment thread src/wasi/mod.rs
Comment thread libc-test/build.rs Outdated
Comment on lines +2008 to +2010
// This was removed in wasip2 target for wasi-sdk-30+, but it's just a
// typedef, so ignore it.
cfg.skip_alias(|s| s.ident() == "__wasi_rights_t");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be deprecated in libc?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea, I've added that now. I've also made it conditional since it's only present on wasip1 targets, not wasip2/wasip3

* Extract wasi-sdk version information from `wasi/version.h`
* Conditionally verify `__wasi_rights_t` for the wasip1 target,
  deprecate it on other targets.
* Use `ptr::null_mut()`.
@alexcrichton

Copy link
Copy Markdown
Member Author

Is there a way to detect wasi version from headers?

There is indeed! There's a wasi/version.h header generated for wasi-sdk which has wasi-sdk and wasip1/p2/p3 version information. I've added that in and use that for conditioanl verification of __wasi_rights_t

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tgross35
tgross35 enabled auto-merge July 22, 2026 14:53
@alexcrichton

Copy link
Copy Markdown
Member Author

Would you be able to restart the failed CI jobs for me? (I think they're spurious but if not I can try to dig in too)

@tgross35
tgross35 added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 22, 2026
@alexcrichton

Copy link
Copy Markdown
Member Author

While not quite #4297, I think that may be a spurious failure in the Android job:

2026-07-22T21:29:41.3370851Z �[1m�[92m    Finished�[0m `test` profile [unoptimized + debuginfo] target(s) in 36.52s
2026-07-22T21:29:41.3422583Z �[1m�[92m     Running�[0m `/tmp/runtest /checkout/target/aarch64-linux-android/debug/deps/cmsg-36294ed4ae28adad --skip check_style`
2026-07-22T21:29:41.3449384Z * daemon not running; starting now at tcp:5037
2026-07-22T21:29:41.3477811Z * daemon started successfully
2026-07-22T21:49:36.5717935Z ##[error]The operation was canceled.
2026-07-22T21:49:36.5774681Z ##[group]Run ./ci/create-artifacts.py

The hang for 20 minutes led to a timeout it looks like :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: CI-related items O-wasi S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants