Skip to content

Commit 6934e52

Browse files
committed
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 <paul.mabileau@harfanglab.fr>
1 parent ad7bc97 commit 6934e52

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
@@ -2003,9 +2003,9 @@ fn test_android(target: &str) {
20032003
| "PF_IO_WORKER"
20042004
| "PF_WQ_WORKER"
20052005
| "PF_FORKNOEXEC"
2006+
| "PF_MCE_PROCESS"
20062007
| "PF_SUPERPRIV"
20072008
| "PF_DUMPCORE"
2008-
| "PF_MCE_PROCESS"
20092009
| "PF_SIGNALED"
20102010
| "PF_MEMALLOC"
20112011
| "PF_NPROC_EXCEEDED"
@@ -2021,6 +2021,7 @@ fn test_android(target: &str) {
20212021
| "PF_NO_SETAFFINITY"
20222022
| "PF_MCE_EARLY"
20232023
| "PF_MEMALLOC_PIN"
2024+
| "PF_BLOCK_TS"
20242025
| "PF_SUSPEND_TASK" => true,
20252026

20262027
_ => false,
@@ -4240,7 +4241,9 @@ fn test_linux(target: &str) {
42404241
| "PF_RANDOMIZE"
42414242
| "PF_NO_SETAFFINITY"
42424243
| "PF_MCE_EARLY"
4243-
| "PF_MEMALLOC_PIN" => true,
4244+
| "PF_MEMALLOC_PIN"
4245+
| "PF_BLOCK_TS"
4246+
| "PF_SUSPEND_TASK" => true,
42444247

42454248
// FIXME: Requires >= 6.9 kernel headers.
42464249
"EPIOCSPARAMS"

src/unix/linux_like/linux/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5693,6 +5693,14 @@ pub const PF_RANDOMIZE: c_int = 0x00400000;
56935693
pub const PF_NO_SETAFFINITY: c_int = 0x04000000;
56945694
pub const PF_MCE_EARLY: c_int = 0x08000000;
56955695
pub const PF_MEMALLOC_PIN: c_int = 0x10000000;
5696+
pub const PF_BLOCK_TS: c_int = 0x20000000;
5697+
pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _;
5698+
// The used value is the highest possible bit fitting on 32 bits, so directly
5699+
// defining it as a signed integer causes the compiler to report an overflow.
5700+
// Use instead a private intermediary that assuringly has the correct type and
5701+
// cast it where necessary to the wanted final type, which preserves the
5702+
// desired information as-is in terms of integer representation.
5703+
const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000;
56965704

56975705
pub const CSIGNAL: c_int = 0x000000ff;
56985706

0 commit comments

Comments
 (0)