diff options
author | bors <bors@rust-lang.org> | 2021-06-03 06:56:17 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2021-06-03 06:56:17 +0000 |
commit | 1d5190618101005058d8d0e3eb8fd1e990be6882 (patch) | |
tree | 8525d771adaff7b6e9478affdf03b09796dbe739 | |
parent | 28650774def78a6821171fd1c24d6f6913b66f23 (diff) | |
parent | f77d49b818d38742f65a8256b9e15a0199516ef8 (diff) | |
download | rust-libc-1d5190618101005058d8d0e3eb8fd1e990be6882.tar.gz |
Auto merge of #2215 - JohnTitor:arphrd-can, r=Amanieu
Declare `ARPHRD_CAN` on the linux_like module
Supersedes #2077, closes #2077
-rw-r--r-- | libc-test/Cargo.toml | 5 | ||||
-rwxr-xr-x | libc-test/build.rs | 19 | ||||
-rw-r--r-- | libc-test/semver/android.txt | 1 | ||||
-rw-r--r-- | libc-test/semver/linux.txt | 1 | ||||
-rw-r--r-- | libc-test/test/linux_if_arp.rs | 12 | ||||
-rw-r--r-- | src/unix/linux_like/mod.rs | 1 |
6 files changed, 38 insertions, 1 deletions
diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 7b8bae6efd..2eb5a0870d 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -37,6 +37,11 @@ path = "test/linux_fcntl.rs" harness = false [[test]] +name = "linux-if-arp" +path = "test/linux_if_arp.rs" +harness = false + +[[test]] name = "linux-ipv6" path = "test/linux_ipv6.rs" harness = false diff --git a/libc-test/build.rs b/libc-test/build.rs index 653b83164e..e4f3a54e41 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2703,6 +2703,9 @@ fn test_linux(target: &str) { | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true, + // The `ARPHRD_CAN` is tested in the `linux_if_arp.rs` tests + // because including `linux/if_arp.h` causes some conflicts: + "ARPHRD_CAN" => true, // Require Linux kernel 5.1: "F_SEAL_FUTURE_WRITE" => true, @@ -3064,7 +3067,6 @@ fn test_linux_like_apis(target: &str) { cfg.header("elf.h"); cfg.skip_fn(|_| true) .skip_static(|_| true) - .skip_fn(|_| true) .skip_const(|_| true) .type_name(move |ty, _is_struct, _is_union| ty.to_string()) .skip_struct(move |ty| match ty { @@ -3077,6 +3079,21 @@ fn test_linux_like_apis(target: &str) { }); cfg.generate("../src/lib.rs", "linux_elf.rs"); } + + if linux || android { + // Test `ARPHRD_CAN`. + let mut cfg = ctest_cfg(); + cfg.header("linux/if_arp.h"); + cfg.skip_fn(|_| true) + .skip_static(|_| true) + .skip_const(move |name| match name { + "ARPHRD_CAN" => false, + _ => true, + }) + .skip_struct(|_| true) + .skip_type(|_| true); + cfg.generate("../src/lib.rs", "linux_if_arp.rs"); + } } fn which_freebsd() -> Option<i32> { diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 117d50e361..bd89dd1e6a 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -69,6 +69,7 @@ ARPHRD_ASH ARPHRD_ATM ARPHRD_AX25 ARPHRD_BIF +ARPHRD_CAN ARPHRD_CHAOS ARPHRD_CISCO ARPHRD_CSLIP diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 128e9d9c1c..76de49a8ce 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -92,6 +92,7 @@ ARPHRD_ASH ARPHRD_ATM ARPHRD_AX25 ARPHRD_BIF +ARPHRD_CAN ARPHRD_CHAOS ARPHRD_CISCO ARPHRD_CSLIP diff --git a/libc-test/test/linux_if_arp.rs b/libc-test/test/linux_if_arp.rs new file mode 100644 index 0000000000..50be071d45 --- /dev/null +++ b/libc-test/test/linux_if_arp.rs @@ -0,0 +1,12 @@ +#![allow(bad_style, improper_ctypes, unused, deprecated)] + +extern crate libc; +use libc::*; + +#[cfg(any(target_os = "linux", target_os = "android"))] +include!(concat!(env!("OUT_DIR"), "/linux_if_arp.rs")); + +#[cfg(not(any(target_os = "linux", target_os = "android")))] +fn main() { + println!("PASSED 0 tests"); +} diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 954e87320b..9654503753 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1306,6 +1306,7 @@ pub const ARPHRD_ADAPT: u16 = 264; pub const ARPHRD_ROSE: u16 = 270; pub const ARPHRD_X25: u16 = 271; pub const ARPHRD_HWX25: u16 = 272; +pub const ARPHRD_CAN: u16 = 280; pub const ARPHRD_PPP: u16 = 512; pub const ARPHRD_CISCO: u16 = 513; pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; |