Skip to content

Commit e02f299

Browse files
Bben01DorianNiemiecSVRJS
authored andcommitted
Add constants from linux/cn_proc.h and linux/connector.h
(backport <rust-lang#4434>) (cherry picked from commit abd00f8)
1 parent a5832db commit e02f299

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
@@ -3874,6 +3874,8 @@ fn test_linux(target: &str) {
38743874
"linux/can.h",
38753875
"linux/can/raw.h",
38763876
"linux/can/j1939.h",
3877+
"linux/cn_proc.h",
3878+
"linux/connector.h",
38773879
"linux/dccp.h",
38783880
"linux/errqueue.h",
38793881
"linux/falloc.h",
@@ -4694,6 +4696,9 @@ fn test_linux(target: &str) {
46944696
// FIXME(linux): Requires >= 6.4 kernel headers.
46954697
"PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG" | "PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG" => true,
46964698

4699+
// FIXME(linux): Requires >= 6.6 kernel headers.
4700+
"PROC_EVENT_NONZERO_EXIT" => true,
4701+
46974702
_ => false,
46984703
}
46994704
});

src/unix/linux_like/linux/mod.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4793,6 +4793,51 @@ pub const RTNLGRP_MCTP_IFADDR: c_uint = 0x22;
47934793
pub const RTNLGRP_TUNNEL: c_uint = 0x23;
47944794
pub const RTNLGRP_STATS: c_uint = 0x24;
47954795

4796+
// linux/cn_proc.h
4797+
c_enum! {
4798+
proc_cn_mcast_op {
4799+
PROC_CN_MCAST_LISTEN = 1,
4800+
PROC_CN_MCAST_IGNORE = 2,
4801+
}
4802+
}
4803+
4804+
c_enum! {
4805+
proc_cn_event {
4806+
PROC_EVENT_NONE = 0x00000000,
4807+
PROC_EVENT_FORK = 0x00000001,
4808+
PROC_EVENT_EXEC = 0x00000002,
4809+
PROC_EVENT_UID = 0x00000004,
4810+
PROC_EVENT_GID = 0x00000040,
4811+
PROC_EVENT_SID = 0x00000080,
4812+
PROC_EVENT_PTRACE = 0x00000100,
4813+
PROC_EVENT_COMM = 0x00000200,
4814+
PROC_EVENT_NONZERO_EXIT = 0x20000000,
4815+
PROC_EVENT_COREDUMP = 0x40000000,
4816+
PROC_EVENT_EXIT = 0x80000000,
4817+
}
4818+
}
4819+
4820+
// linux/connector.h
4821+
pub const CN_IDX_PROC: c_uint = 0x1;
4822+
pub const CN_VAL_PROC: c_uint = 0x1;
4823+
pub const CN_IDX_CIFS: c_uint = 0x2;
4824+
pub const CN_VAL_CIFS: c_uint = 0x1;
4825+
pub const CN_W1_IDX: c_uint = 0x3;
4826+
pub const CN_W1_VAL: c_uint = 0x1;
4827+
pub const CN_IDX_V86D: c_uint = 0x4;
4828+
pub const CN_VAL_V86D_UVESAFB: c_uint = 0x1;
4829+
pub const CN_IDX_BB: c_uint = 0x5;
4830+
pub const CN_DST_IDX: c_uint = 0x6;
4831+
pub const CN_DST_VAL: c_uint = 0x1;
4832+
pub const CN_IDX_DM: c_uint = 0x7;
4833+
pub const CN_VAL_DM_USERSPACE_LOG: c_uint = 0x1;
4834+
pub const CN_IDX_DRBD: c_uint = 0x8;
4835+
pub const CN_VAL_DRBD: c_uint = 0x1;
4836+
pub const CN_KVP_IDX: c_uint = 0x9;
4837+
pub const CN_KVP_VAL: c_uint = 0x1;
4838+
pub const CN_VSS_IDX: c_uint = 0xA;
4839+
pub const CN_VSS_VAL: c_uint = 0x1;
4840+
47964841
// linux/module.h
47974842
pub const MODULE_INIT_IGNORE_MODVERSIONS: c_uint = 0x0001;
47984843
pub const MODULE_INIT_IGNORE_VERMAGIC: c_uint = 0x0002;

0 commit comments

Comments
 (0)