Skip to content

Commit

Permalink
Feat(linux): Add new process flags
Browse files Browse the repository at this point in the history
`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)
  • Loading branch information
PaulDance authored and tgross35 committed Dec 9, 2024
1 parent 008ffc1 commit 0e89233
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 0e89233

Please sign in to comment.