From b0dd5ff83cdf84554e45dc424d204a41bd6b2e39 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 6 Nov 2024 20:13:34 -0600 Subject: [PATCH 1/3] Remove the `wasm32-wasi` target Since [1], the `wasm32-wasi` target is no longer supported (replaced by `wasm32-wasip1` and `wasm32-wasip2`). This has made it into the latest nightly, so remove it from our testing. [1]: https://github.com/rust-lang/rust/pull/132562 (backport ) (cherry picked from commit a4d3ca87aa0cbe52b728ab88d59d2cee9b1aa21e) --- Cargo.toml | 1 - ci/build.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 04183f0c2623a..b0eacb4cdaa94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,7 +107,6 @@ targets = [ "thumbv7neon-unknown-linux-gnueabihf", "wasm32-unknown-emscripten", "wasm32-unknown-unknown", - "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fortanix-unknown-sgx", diff --git a/ci/build.sh b/ci/build.sh index d4b85ccbf0bd9..28655238e9f65 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -136,7 +136,6 @@ armv5te-unknown-linux-gnueabi \ armv5te-unknown-linux-musleabi \ i686-pc-windows-gnu \ riscv64gc-unknown-linux-gnu \ -wasm32-wasi \ x86_64-fortanix-unknown-sgx \ x86_64-unknown-fuchsia \ x86_64-pc-solaris \ From bcae06edb49932a31ef5a32437367505f60b803e Mon Sep 17 00:00:00 2001 From: Pedro Tammela Date: Fri, 13 Sep 2024 17:46:49 -0300 Subject: [PATCH 2/3] epoll: add busy polling parameters In Linux 6.9 a new ioctl for epoll was added: https://man.archlinux.org/man/ioctl_eventpoll.2.en Add support for it. The ioctls constants are padded to 64 bits alignment even on 32 bits machines. Signed-off-by: Pedro Tammela (backport ) (cherry picked from commit fb58c011af41a5a3d3ad3082c9263be5ae395751) Signed-off-by: Trevor Gross --- libc-test/build.rs | 7 +++++++ libc-test/semver/linux.txt | 3 +++ src/unix/linux_like/linux/mod.rs | 13 +++++++++++++ 3 files changed, 23 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index b86d9516b8744..750b3869205e9 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3864,6 +3864,9 @@ fn test_linux(target: &str) { // kernel so we can drop this and test the type once this new version is used in CI. "sched_attr" => true, + // FIXME: Requires >= 6.9 kernel headers. + "epoll_params" => true, + _ => false, } }); @@ -4306,6 +4309,10 @@ fn test_linux(target: &str) { | "SCHED_FLAG_UTIL_CLAMP" | "SCHED_FLAG_ALL" if musl => true, // Needs more recent linux headers. + // FIXME: Requires >= 6.9 kernel headers. + "EPIOCSPARAMS" + | "EPIOCGPARAMS" => true, + _ => false, } }); diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index a5ccef469541d..6c10f1234226b 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -550,6 +550,8 @@ ENOTSUP ENOTUNIQ EOF EOWNERDEAD +EPIOCGPARAMS +EPIOCSPARAMS EPOLLERR EPOLLET EPOLLEXCLUSIVE @@ -3489,6 +3491,7 @@ epoll_create epoll_create1 epoll_ctl epoll_event +epoll_params epoll_pwait epoll_wait erand48 diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 20c4a16979087..f26af4c1fe16f 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -880,6 +880,15 @@ s! { pub salt: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE], pub rec_seq: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE], } + + // #include + + pub struct epoll_params { + pub busy_poll_usecs: u32, + pub busy_poll_budget: u16, + pub prefer_busy_poll: u8, + pub __pad: u8, // Must be zero + } } s_no_extra_traits! { @@ -4936,6 +4945,10 @@ pub const SCHED_FLAG_ALL: ::c_int = SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_KEEP_ALL | SCHED_FLAG_UTIL_CLAMP; +// ioctl_eventpoll: added in Linux 6.9 +pub const EPIOCSPARAMS: ::Ioctl = 0x40088a01; +pub const EPIOCGPARAMS: ::Ioctl = 0x80088a02; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) From f035b10e24081ec8c3f7acb28dcfc285878fc776 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 11 Sep 2024 03:54:03 +0100 Subject: [PATCH 3/3] Add host_cpu_load_info on Apple Snippet from `host_info.h`: ``` struct host_cpu_load_info { /* number of ticks while running... */ natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */ }; typedef struct host_cpu_load_info host_cpu_load_info_data_t; typedef struct host_cpu_load_info *host_cpu_load_info_t; ``` (backport ) (cherry picked from commit f31fe2adb0b1a7836313463d9fad4771e939372f) --- libc-test/semver/apple.txt | 3 +++ src/unix/bsd/apple/mod.rs | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 11f26658c2a47..e5de0f02136af 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1983,6 +1983,9 @@ getxattr glob glob_t globfree +host_cpu_load_info +host_cpu_load_info_data_t +host_cpu_load_info_t iconv iconv_close iconv_open diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 0017403410f4c..8f882f9b6954d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -72,6 +72,11 @@ pub type ledger_array_t = *mut ::ledger_t; pub type iconv_t = *mut ::c_void; +// mach/host_info.h +pub type host_cpu_load_info_t = *mut host_cpu_load_info; +pub type host_cpu_load_info_data_t = host_cpu_load_info; + +// mach/processor_info.h pub type processor_cpu_load_info_t = *mut processor_cpu_load_info; pub type processor_cpu_load_info_data_t = processor_cpu_load_info; pub type processor_basic_info_t = *mut processor_basic_info; @@ -1189,6 +1194,11 @@ s! { pub tcpi_rxoutoforderbytes: u64, pub tcpi_rxretransmitpackets: u64, } + + // mach/host_info.h + pub struct host_cpu_load_info { + pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize], + } } s_no_extra_traits! {