From 0e89233900e524347c810287ff8f1bb03bdb0e9a Mon Sep 17 00:00:00 2001 From: Paul Mabileau Date: Fri, 6 Dec 2024 15:57:21 +0100 Subject: [PATCH] Feat(linux): Add new process flags `PF_BLOCK_TS` and `PF_SUSPEND_TASK`. They are also added to the tests. Interestingly, `PF_SUSPEND_TASK` is already there somewhere in the build script :thinking: Signed-off-by: Paul Mabileau (backport ) (cherry picked from commit 6934e52de8921a079118867d30a3894e46f98037) --- libc-test/build.rs | 7 +++++-- src/unix/linux_like/linux/mod.rs | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index a1547d8e2f6f..1af2c40afdf1 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2062,9 +2062,9 @@ fn test_android(target: &str) { | "PF_IO_WORKER" | "PF_WQ_WORKER" | "PF_FORKNOEXEC" + | "PF_MCE_PROCESS" | "PF_SUPERPRIV" | "PF_DUMPCORE" - | "PF_MCE_PROCESS" | "PF_SIGNALED" | "PF_MEMALLOC" | "PF_NPROC_EXCEEDED" @@ -2080,6 +2080,7 @@ fn test_android(target: &str) { | "PF_NO_SETAFFINITY" | "PF_MCE_EARLY" | "PF_MEMALLOC_PIN" + | "PF_BLOCK_TS" | "PF_SUSPEND_TASK" => true, _ => false, @@ -4315,7 +4316,9 @@ fn test_linux(target: &str) { | "PF_RANDOMIZE" | "PF_NO_SETAFFINITY" | "PF_MCE_EARLY" - | "PF_MEMALLOC_PIN" => true, + | "PF_MEMALLOC_PIN" + | "PF_BLOCK_TS" + | "PF_SUSPEND_TASK" => true, // FIXME: Requires >= 6.9 kernel headers. "EPIOCSPARAMS" diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index d4652ddf8d6e..281f4221493a 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -5656,6 +5656,14 @@ pub const PF_RANDOMIZE: c_int = 0x00400000; pub const PF_NO_SETAFFINITY: c_int = 0x04000000; pub const PF_MCE_EARLY: c_int = 0x08000000; pub const PF_MEMALLOC_PIN: c_int = 0x10000000; +pub const PF_BLOCK_TS: c_int = 0x20000000; +pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _; +// The used value is the highest possible bit fitting on 32 bits, so directly +// defining it as a signed integer causes the compiler to report an overflow. +// Use instead a private intermediary that assuringly has the correct type and +// cast it where necessary to the wanted final type, which preserves the +// desired information as-is in terms of integer representation. +const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000; pub const CSIGNAL: c_int = 0x000000ff;