Skip to content

Commit 3451a9d

Browse files
authored
Merge pull request #4434 from Bben01/feature/add-connector-constants
Add constants from linux/cn_proc.h and linux/connector.h
2 parents 5c06810 + abd00f8 commit 3451a9d

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
@@ -3805,6 +3805,8 @@ fn test_linux(target: &str) {
38053805
"linux/can.h",
38063806
"linux/can/raw.h",
38073807
"linux/can/j1939.h",
3808+
"linux/cn_proc.h",
3809+
"linux/connector.h",
38083810
"linux/dccp.h",
38093811
"linux/errqueue.h",
38103812
"linux/falloc.h",
@@ -4625,6 +4627,9 @@ fn test_linux(target: &str) {
46254627
// FIXME(linux): Requires >= 6.4 kernel headers.
46264628
"PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG" | "PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG" => true,
46274629

4630+
// FIXME(linux): Requires >= 6.6 kernel headers.
4631+
"PROC_EVENT_NONZERO_EXIT" => true,
4632+
46284633
_ => false,
46294634
}
46304635
});

src/unix/linux_like/linux/mod.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4694,6 +4694,51 @@ pub const RTNLGRP_MCTP_IFADDR: c_uint = 0x22;
46944694
pub const RTNLGRP_TUNNEL: c_uint = 0x23;
46954695
pub const RTNLGRP_STATS: c_uint = 0x24;
46964696

4697+
// linux/cn_proc.h
4698+
c_enum! {
4699+
proc_cn_mcast_op {
4700+
PROC_CN_MCAST_LISTEN = 1,
4701+
PROC_CN_MCAST_IGNORE = 2,
4702+
}
4703+
}
4704+
4705+
c_enum! {
4706+
proc_cn_event {
4707+
PROC_EVENT_NONE = 0x00000000,
4708+
PROC_EVENT_FORK = 0x00000001,
4709+
PROC_EVENT_EXEC = 0x00000002,
4710+
PROC_EVENT_UID = 0x00000004,
4711+
PROC_EVENT_GID = 0x00000040,
4712+
PROC_EVENT_SID = 0x00000080,
4713+
PROC_EVENT_PTRACE = 0x00000100,
4714+
PROC_EVENT_COMM = 0x00000200,
4715+
PROC_EVENT_NONZERO_EXIT = 0x20000000,
4716+
PROC_EVENT_COREDUMP = 0x40000000,
4717+
PROC_EVENT_EXIT = 0x80000000,
4718+
}
4719+
}
4720+
4721+
// linux/connector.h
4722+
pub const CN_IDX_PROC: c_uint = 0x1;
4723+
pub const CN_VAL_PROC: c_uint = 0x1;
4724+
pub const CN_IDX_CIFS: c_uint = 0x2;
4725+
pub const CN_VAL_CIFS: c_uint = 0x1;
4726+
pub const CN_W1_IDX: c_uint = 0x3;
4727+
pub const CN_W1_VAL: c_uint = 0x1;
4728+
pub const CN_IDX_V86D: c_uint = 0x4;
4729+
pub const CN_VAL_V86D_UVESAFB: c_uint = 0x1;
4730+
pub const CN_IDX_BB: c_uint = 0x5;
4731+
pub const CN_DST_IDX: c_uint = 0x6;
4732+
pub const CN_DST_VAL: c_uint = 0x1;
4733+
pub const CN_IDX_DM: c_uint = 0x7;
4734+
pub const CN_VAL_DM_USERSPACE_LOG: c_uint = 0x1;
4735+
pub const CN_IDX_DRBD: c_uint = 0x8;
4736+
pub const CN_VAL_DRBD: c_uint = 0x1;
4737+
pub const CN_KVP_IDX: c_uint = 0x9;
4738+
pub const CN_KVP_VAL: c_uint = 0x1;
4739+
pub const CN_VSS_IDX: c_uint = 0xA;
4740+
pub const CN_VSS_VAL: c_uint = 0x1;
4741+
46974742
// linux/module.h
46984743
pub const MODULE_INIT_IGNORE_MODVERSIONS: c_uint = 0x0001;
46994744
pub const MODULE_INIT_IGNORE_VERMAGIC: c_uint = 0x0002;

0 commit comments

Comments
 (0)