Skip to content

Commit f77d49b

Browse files
committed
Declare ARPHRD_CAN on the linux_like module
1 parent 2865077 commit f77d49b

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

libc-test/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ name = "linux-fcntl"
3636
path = "test/linux_fcntl.rs"
3737
harness = false
3838

39+
[[test]]
40+
name = "linux-if-arp"
41+
path = "test/linux_if_arp.rs"
42+
harness = false
43+
3944
[[test]]
4045
name = "linux-ipv6"
4146
path = "test/linux_ipv6.rs"

libc-test/build.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,9 @@ fn test_linux(target: &str) {
27032703
| "F_SEAL_SHRINK"
27042704
| "F_SEAL_GROW"
27052705
| "F_SEAL_WRITE" => true,
2706+
// The `ARPHRD_CAN` is tested in the `linux_if_arp.rs` tests
2707+
// because including `linux/if_arp.h` causes some conflicts:
2708+
"ARPHRD_CAN" => true,
27062709

27072710
// Require Linux kernel 5.1:
27082711
"F_SEAL_FUTURE_WRITE" => true,
@@ -3064,7 +3067,6 @@ fn test_linux_like_apis(target: &str) {
30643067
cfg.header("elf.h");
30653068
cfg.skip_fn(|_| true)
30663069
.skip_static(|_| true)
3067-
.skip_fn(|_| true)
30683070
.skip_const(|_| true)
30693071
.type_name(move |ty, _is_struct, _is_union| ty.to_string())
30703072
.skip_struct(move |ty| match ty {
@@ -3077,6 +3079,21 @@ fn test_linux_like_apis(target: &str) {
30773079
});
30783080
cfg.generate("../src/lib.rs", "linux_elf.rs");
30793081
}
3082+
3083+
if linux || android {
3084+
// Test `ARPHRD_CAN`.
3085+
let mut cfg = ctest_cfg();
3086+
cfg.header("linux/if_arp.h");
3087+
cfg.skip_fn(|_| true)
3088+
.skip_static(|_| true)
3089+
.skip_const(move |name| match name {
3090+
"ARPHRD_CAN" => false,
3091+
_ => true,
3092+
})
3093+
.skip_struct(|_| true)
3094+
.skip_type(|_| true);
3095+
cfg.generate("../src/lib.rs", "linux_if_arp.rs");
3096+
}
30803097
}
30813098

30823099
fn which_freebsd() -> Option<i32> {

libc-test/semver/android.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ ARPHRD_ASH
6969
ARPHRD_ATM
7070
ARPHRD_AX25
7171
ARPHRD_BIF
72+
ARPHRD_CAN
7273
ARPHRD_CHAOS
7374
ARPHRD_CISCO
7475
ARPHRD_CSLIP

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ ARPHRD_ASH
9292
ARPHRD_ATM
9393
ARPHRD_AX25
9494
ARPHRD_BIF
95+
ARPHRD_CAN
9596
ARPHRD_CHAOS
9697
ARPHRD_CISCO
9798
ARPHRD_CSLIP

libc-test/test/linux_if_arp.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![allow(bad_style, improper_ctypes, unused, deprecated)]
2+
3+
extern crate libc;
4+
use libc::*;
5+
6+
#[cfg(any(target_os = "linux", target_os = "android"))]
7+
include!(concat!(env!("OUT_DIR"), "/linux_if_arp.rs"));
8+
9+
#[cfg(not(any(target_os = "linux", target_os = "android")))]
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

src/unix/linux_like/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ pub const ARPHRD_ADAPT: u16 = 264;
13061306
pub const ARPHRD_ROSE: u16 = 270;
13071307
pub const ARPHRD_X25: u16 = 271;
13081308
pub const ARPHRD_HWX25: u16 = 272;
1309+
pub const ARPHRD_CAN: u16 = 280;
13091310
pub const ARPHRD_PPP: u16 = 512;
13101311
pub const ARPHRD_CISCO: u16 = 513;
13111312
pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO;

0 commit comments

Comments
 (0)