Skip to content

Commit 0e89233

Browse files
PaulDancetgross35
authored andcommitted
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 🤔 Signed-off-by: Paul Mabileau <[email protected]> (backport <#4174>) (cherry picked from commit 6934e52)
1 parent 008ffc1 commit 0e89233

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

libc-test/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,9 +2062,9 @@ fn test_android(target: &str) {
20622062
| "PF_IO_WORKER"
20632063
| "PF_WQ_WORKER"
20642064
| "PF_FORKNOEXEC"
2065+
| "PF_MCE_PROCESS"
20652066
| "PF_SUPERPRIV"
20662067
| "PF_DUMPCORE"
2067-
| "PF_MCE_PROCESS"
20682068
| "PF_SIGNALED"
20692069
| "PF_MEMALLOC"
20702070
| "PF_NPROC_EXCEEDED"
@@ -2080,6 +2080,7 @@ fn test_android(target: &str) {
20802080
| "PF_NO_SETAFFINITY"
20812081
| "PF_MCE_EARLY"
20822082
| "PF_MEMALLOC_PIN"
2083+
| "PF_BLOCK_TS"
20832084
| "PF_SUSPEND_TASK" => true,
20842085

20852086
_ => false,
@@ -4315,7 +4316,9 @@ fn test_linux(target: &str) {
43154316
| "PF_RANDOMIZE"
43164317
| "PF_NO_SETAFFINITY"
43174318
| "PF_MCE_EARLY"
4318-
| "PF_MEMALLOC_PIN" => true,
4319+
| "PF_MEMALLOC_PIN"
4320+
| "PF_BLOCK_TS"
4321+
| "PF_SUSPEND_TASK" => true,
43194322

43204323
// FIXME: Requires >= 6.9 kernel headers.
43214324
"EPIOCSPARAMS"

src/unix/linux_like/linux/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5656,6 +5656,14 @@ pub const PF_RANDOMIZE: c_int = 0x00400000;
56565656
pub const PF_NO_SETAFFINITY: c_int = 0x04000000;
56575657
pub const PF_MCE_EARLY: c_int = 0x08000000;
56585658
pub const PF_MEMALLOC_PIN: c_int = 0x10000000;
5659+
pub const PF_BLOCK_TS: c_int = 0x20000000;
5660+
pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _;
5661+
// The used value is the highest possible bit fitting on 32 bits, so directly
5662+
// defining it as a signed integer causes the compiler to report an overflow.
5663+
// Use instead a private intermediary that assuringly has the correct type and
5664+
// cast it where necessary to the wanted final type, which preserves the
5665+
// desired information as-is in terms of integer representation.
5666+
const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000;
56595667

56605668
pub const CSIGNAL: c_int = 0x000000ff;
56615669

0 commit comments

Comments
 (0)