Skip to content

Commit 96ed9c6

Browse files
authored
Merge pull request #4174 from PaulDance/linux-new-proc-flags
Feat(Linux): Add new process flags
2 parents ad7bc97 + 5997f35 commit 96ed9c6

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-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"

libc-test/semver/linux.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,40 +2085,67 @@ PF_ASH
20852085
PF_ATMPVC
20862086
PF_ATMSVC
20872087
PF_AX25
2088+
PF_BLOCK_TS
20882089
PF_BLUETOOTH
20892090
PF_BRIDGE
20902091
PF_CAIF
20912092
PF_CAN
20922093
PF_DECnet
2094+
PF_DUMPCORE
20932095
PF_ECONET
2096+
PF_EXITING
2097+
PF_FORKNOEXEC
2098+
PF_IDLE
20942099
PF_IEEE802154
2100+
PF_IO_WORKER
20952101
PF_IPX
20962102
PF_IRDA
20972103
PF_ISDN
20982104
PF_IUCV
20992105
PF_KEY
2106+
PF_KSWAPD
2107+
PF_KTHREAD
21002108
PF_LLC
21012109
PF_LOCAL
2110+
PF_LOCAL_THROTTLE
21022111
PF_MASKOS
21032112
PF_MASKPROC
2113+
PF_MCE_EARLY
2114+
PF_MCE_PROCESS
2115+
PF_MEMALLOC
2116+
PF_MEMALLOC_NOFS
2117+
PF_MEMALLOC_NOIO
2118+
PF_MEMALLOC_PIN
21042119
PF_NETBEUI
21052120
PF_NETLINK
21062121
PF_NETROM
21072122
PF_NFC
2123+
PF_NOFREEZE
2124+
PF_NO_SETAFFINITY
2125+
PF_NPROC_EXCEEDED
21082126
PF_PACKET
21092127
PF_PHONET
2128+
PF_POSTCOREDUMP
21102129
PF_PPPOX
21112130
PF_R
2131+
PF_RANDOMIZE
21122132
PF_RDS
21132133
PF_ROSE
21142134
PF_ROUTE
21152135
PF_RXRPC
21162136
PF_SECURITY
2137+
PF_SIGNALED
21172138
PF_SNA
2139+
PF_SUPERPRIV
2140+
PF_SUSPEND_TASK
21182141
PF_TIPC
2142+
PF_USED_MATH
2143+
PF_USER_WORKER
2144+
PF_VCPU
21192145
PF_VSOCK
21202146
PF_W
21212147
PF_WANPIPE
2148+
PF_WQ_WORKER
21222149
PF_X
21232150
PF_X25
21242151
PIPE_BUF

src/unix/linux_like/linux/mod.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5668,31 +5668,75 @@ pub const NET_DCCP: c_int = 20;
56685668
pub const NET_IRDA: c_int = 412;
56695669

56705670
// include/linux/sched.h
5671+
/// I'm a virtual CPU.
56715672
pub const PF_VCPU: c_int = 0x00000001;
5673+
/// I am an IDLE thread.
56725674
pub const PF_IDLE: c_int = 0x00000002;
5675+
/// Getting shut down.
56735676
pub const PF_EXITING: c_int = 0x00000004;
5677+
/// Coredumps should ignore this task.
56745678
pub const PF_POSTCOREDUMP: c_int = 0x00000008;
5679+
/// Task is an IO worker.
56755680
pub const PF_IO_WORKER: c_int = 0x00000010;
5681+
/// I'm a workqueue worker.
56765682
pub const PF_WQ_WORKER: c_int = 0x00000020;
5683+
/// Forked but didn't exec.
56775684
pub const PF_FORKNOEXEC: c_int = 0x00000040;
5685+
/// Process policy on mce errors.
56785686
pub const PF_MCE_PROCESS: c_int = 0x00000080;
5687+
/// Used super-user privileges.
56795688
pub const PF_SUPERPRIV: c_int = 0x00000100;
5689+
/// Dumped core.
56805690
pub const PF_DUMPCORE: c_int = 0x00000200;
5691+
/// Killed by a signal.
56815692
pub const PF_SIGNALED: c_int = 0x00000400;
5693+
/// Allocating memory to free memory.
5694+
///
5695+
/// See `memalloc_noreclaim_save()`.
56825696
pub const PF_MEMALLOC: c_int = 0x00000800;
5697+
/// `set_user()` noticed that `RLIMIT_NPROC` was exceeded.
56835698
pub const PF_NPROC_EXCEEDED: c_int = 0x00001000;
5699+
/// If unset the fpu must be initialized before use.
56845700
pub const PF_USED_MATH: c_int = 0x00002000;
5701+
/// Kernel thread cloned from userspace thread.
56855702
pub const PF_USER_WORKER: c_int = 0x00004000;
5703+
/// This thread should not be frozen.
56865704
pub const PF_NOFREEZE: c_int = 0x00008000;
5705+
/// I am `kswapd`.
56875706
pub const PF_KSWAPD: c_int = 0x00020000;
5707+
/// All allocations inherit `GFP_NOFS`.
5708+
///
5709+
/// See `memalloc_nfs_save()`.
56885710
pub const PF_MEMALLOC_NOFS: c_int = 0x00040000;
5711+
/// All allocations inherit `GFP_NOIO`.
5712+
///
5713+
/// See `memalloc_noio_save()`.
56895714
pub const PF_MEMALLOC_NOIO: c_int = 0x00080000;
5715+
/// Throttle writes only against the bdi I write to, I am cleaning
5716+
/// dirty pages from some other bdi.
56905717
pub const PF_LOCAL_THROTTLE: c_int = 0x00100000;
5718+
/// I am a kernel thread.
56915719
pub const PF_KTHREAD: c_int = 0x00200000;
5720+
/// Randomize virtual address space.
56925721
pub const PF_RANDOMIZE: c_int = 0x00400000;
5722+
/// Userland is not allowed to meddle with `cpus_mask`.
56935723
pub const PF_NO_SETAFFINITY: c_int = 0x04000000;
5724+
/// Early kill for mce process policy.
56945725
pub const PF_MCE_EARLY: c_int = 0x08000000;
5726+
/// Allocations constrained to zones which allow long term pinning.
5727+
///
5728+
/// See `memalloc_pin_save()`.
56955729
pub const PF_MEMALLOC_PIN: c_int = 0x10000000;
5730+
/// Plug has ts that needs updating.
5731+
pub const PF_BLOCK_TS: c_int = 0x20000000;
5732+
/// This thread called `freeze_processes()` and should not be frozen.
5733+
pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _;
5734+
// The used value is the highest possible bit fitting on 32 bits, so directly
5735+
// defining it as a signed integer causes the compiler to report an overflow.
5736+
// Use instead a private intermediary that assuringly has the correct type and
5737+
// cast it where necessary to the wanted final type, which preserves the
5738+
// desired information as-is in terms of integer representation.
5739+
const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000;
56965740

56975741
pub const CSIGNAL: c_int = 0x000000ff;
56985742

0 commit comments

Comments
 (0)