Skip to content

Commit 00c1999

Browse files
Bben01tgross35
authored andcommitted
Add constants from linux/cn_proc.h and linux/connector.h
(backport <#4434>) (cherry picked from commit abd00f8)
1 parent a64612f commit 00c1999

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

ci/style.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ while IFS= read -r file; do
2626

2727
# Turn all braced macro `foo! { /* ... */ }` invocations into
2828
# `fn foo_fmt_tmp() { /* ... */ }`.
29-
perl -pi -e 's/(?!macro_rules)\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' "$file"
29+
perl -pi -e 's/(?!macro_rules|c_enum)\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' "$file"
3030

3131
# Replace `if #[cfg(...)]` within `cfg_if` with `if cfg_tmp!([...])` which
3232
# `rustfmt` will format. We put brackets within the parens so it is easy to

libc-test/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,6 +3879,8 @@ fn test_linux(target: &str) {
38793879
"linux/can.h",
38803880
"linux/can/raw.h",
38813881
"linux/can/j1939.h",
3882+
"linux/cn_proc.h",
3883+
"linux/connector.h",
38823884
"linux/dccp.h",
38833885
"linux/errqueue.h",
38843886
"linux/falloc.h",
@@ -4699,6 +4701,9 @@ fn test_linux(target: &str) {
46994701
// FIXME(linux): Requires >= 6.4 kernel headers.
47004702
"PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG" | "PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG" => true,
47014703

4704+
// FIXME(linux): Requires >= 6.6 kernel headers.
4705+
"PROC_EVENT_NONZERO_EXIT" => true,
4706+
47024707
_ => false,
47034708
}
47044709
});

src/unix/linux_like/linux/mod.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,6 +4734,51 @@ pub const RTNLGRP_MCTP_IFADDR: c_uint = 0x22;
47344734
pub const RTNLGRP_TUNNEL: c_uint = 0x23;
47354735
pub const RTNLGRP_STATS: c_uint = 0x24;
47364736

4737+
// linux/cn_proc.h
4738+
c_enum! {
4739+
proc_cn_mcast_op {
4740+
PROC_CN_MCAST_LISTEN = 1,
4741+
PROC_CN_MCAST_IGNORE = 2,
4742+
}
4743+
}
4744+
4745+
c_enum! {
4746+
proc_cn_event {
4747+
PROC_EVENT_NONE = 0x00000000,
4748+
PROC_EVENT_FORK = 0x00000001,
4749+
PROC_EVENT_EXEC = 0x00000002,
4750+
PROC_EVENT_UID = 0x00000004,
4751+
PROC_EVENT_GID = 0x00000040,
4752+
PROC_EVENT_SID = 0x00000080,
4753+
PROC_EVENT_PTRACE = 0x00000100,
4754+
PROC_EVENT_COMM = 0x00000200,
4755+
PROC_EVENT_NONZERO_EXIT = 0x20000000,
4756+
PROC_EVENT_COREDUMP = 0x40000000,
4757+
PROC_EVENT_EXIT = 0x80000000,
4758+
}
4759+
}
4760+
4761+
// linux/connector.h
4762+
pub const CN_IDX_PROC: c_uint = 0x1;
4763+
pub const CN_VAL_PROC: c_uint = 0x1;
4764+
pub const CN_IDX_CIFS: c_uint = 0x2;
4765+
pub const CN_VAL_CIFS: c_uint = 0x1;
4766+
pub const CN_W1_IDX: c_uint = 0x3;
4767+
pub const CN_W1_VAL: c_uint = 0x1;
4768+
pub const CN_IDX_V86D: c_uint = 0x4;
4769+
pub const CN_VAL_V86D_UVESAFB: c_uint = 0x1;
4770+
pub const CN_IDX_BB: c_uint = 0x5;
4771+
pub const CN_DST_IDX: c_uint = 0x6;
4772+
pub const CN_DST_VAL: c_uint = 0x1;
4773+
pub const CN_IDX_DM: c_uint = 0x7;
4774+
pub const CN_VAL_DM_USERSPACE_LOG: c_uint = 0x1;
4775+
pub const CN_IDX_DRBD: c_uint = 0x8;
4776+
pub const CN_VAL_DRBD: c_uint = 0x1;
4777+
pub const CN_KVP_IDX: c_uint = 0x9;
4778+
pub const CN_KVP_VAL: c_uint = 0x1;
4779+
pub const CN_VSS_IDX: c_uint = 0xA;
4780+
pub const CN_VSS_VAL: c_uint = 0x1;
4781+
47374782
// linux/module.h
47384783
pub const MODULE_INIT_IGNORE_MODVERSIONS: c_uint = 0x0001;
47394784
pub const MODULE_INIT_IGNORE_VERMAGIC: c_uint = 0x0002;

0 commit comments

Comments
 (0)