Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constants from <include/linux/sched.h> #3505

Merged
merged 2 commits into from Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions libc-test/build.rs
Expand Up @@ -4056,6 +4056,33 @@ fn test_linux(target: &str) {
true
}

// FIXME: seems to not be available all the time (from <linux/include/sched.h>:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// FIXME: seems to not be available all the time (from <linux/include/sched.h>:
// FIXME: seems to not be available all the time (from <include/linux/sched.h>:

Seems swapped, but yeah, it's weird that 23.10 couldn't find them which has the v6.5 kernel header 🤔

"PF_VCPU"
| "PF_IDLE"
| "PF_EXITING"
| "PF_POSTCOREDUMP"
| "PF_IO_WORKER"
| "PF_WQ_WORKER"
| "PF_FORKNOEXEC"
| "PF_MCE_PROCESS"
| "PF_SUPERPRIV"
| "PF_DUMPCORE"
| "PF_SIGNALED"
| "PF_MEMALLOC"
| "PF_NPROC_EXCEEDED"
| "PF_USED_MATH"
| "PF_USER_WORKER"
| "PF_NOFREEZE"
| "PF_KSWAPD"
| "PF_MEMALLOC_NOFS"
| "PF_MEMALLOC_NOIO"
| "PF_LOCAL_THROTTLE"
| "PF_KTHREAD"
| "PF_RANDOMIZE"
| "PF_NO_SETAFFINITY"
| "PF_MCE_EARLY"
| "PF_MEMALLOC_PIN" => true,

_ => false,
}
});
Expand Down
27 changes: 27 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Expand Up @@ -4519,6 +4519,33 @@ pub const NET_NETFILTER: ::c_int = 19;
pub const NET_DCCP: ::c_int = 20;
pub const NET_IRDA: ::c_int = 412;

// include/linux/sched.h
pub const PF_VCPU: ::c_int = 0x00000001;
pub const PF_IDLE: ::c_int = 0x00000002;
pub const PF_EXITING: ::c_int = 0x00000004;
pub const PF_POSTCOREDUMP: ::c_int = 0x00000008;
pub const PF_IO_WORKER: ::c_int = 0x00000010;
pub const PF_WQ_WORKER: ::c_int = 0x00000020;
pub const PF_FORKNOEXEC: ::c_int = 0x00000040;
pub const PF_MCE_PROCESS: ::c_int = 0x00000080;
pub const PF_SUPERPRIV: ::c_int = 0x00000100;
pub const PF_DUMPCORE: ::c_int = 0x00000200;
pub const PF_SIGNALED: ::c_int = 0x00000400;
pub const PF_MEMALLOC: ::c_int = 0x00000800;
pub const PF_NPROC_EXCEEDED: ::c_int = 0x00001000;
pub const PF_USED_MATH: ::c_int = 0x00002000;
pub const PF_USER_WORKER: ::c_int = 0x00004000;
pub const PF_NOFREEZE: ::c_int = 0x00008000;
pub const PF_KSWAPD: ::c_int = 0x00020000;
pub const PF_MEMALLOC_NOFS: ::c_int = 0x00040000;
pub const PF_MEMALLOC_NOIO: ::c_int = 0x00080000;
pub const PF_LOCAL_THROTTLE: ::c_int = 0x00100000;
pub const PF_KTHREAD: ::c_int = 0x00200000;
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;

f! {
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)
Expand Down