Skip to content

Commit dc440c3

Browse files
committed
freebsd: move net/if_mib.h contents to submodule
There is a conflict of NETLINK_GENERIC definitions between net/if_mib.h and netlink/netlink.h. netlink.h is already exported in the crate root for Linux (and those definitions are already used by at least crates neli and netlink-packet-route), and if_mib is not much used yet, so this moves if_mib contents into its own namespace to leave place for netlink support on FreeBSD (rust-lang#3194). Module definition moved to the end of file to avoid cryptic style.rs error "constant found after module when it belongs before". ctest as of 0.22 cannot be told a given header's symbols live in a submodule, so let the tests ignore all of them. Signed-off-by: Yann Dirson <[email protected]>
1 parent 7df63bd commit dc440c3

File tree

3 files changed

+74
-45
lines changed

3 files changed

+74
-45
lines changed

libc-test/build.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,6 +2477,33 @@ fn test_freebsd(target: &str) {
24772477
// FIXME: Removed in FreeBSD 15:
24782478
"LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true,
24792479

2480+
// submodule ifmib, cannot be checked today
2481+
"DOT3COMPLIANCE_STATS"
2482+
| "DOT3COMPLIANCE_COLLS"
2483+
| "IFDATA_GENERAL"
2484+
| "IFDATA_LINKSPECIFIC"
2485+
| "IFDATA_DRIVERNAME"
2486+
| "IFMIB_IFCOUNT"
2487+
| "IFMIB_IFDATA"
2488+
| "IFMIB_SYSTEM"
2489+
| "NETLINK_GENERIC"
2490+
| "dot3ChipSetAMD7990"
2491+
| "dot3ChipSetAMD79900"
2492+
| "dot3ChipSetAMD79C940"
2493+
| "dot3ChipSetIntel82586"
2494+
| "dot3ChipSetIntel82596"
2495+
| "dot3ChipSetIntel82557"
2496+
| "dot3ChipSetNational8390"
2497+
| "dot3ChipSetNationalSonic"
2498+
| "dot3ChipSetFujitsu86950"
2499+
| "dot3ChipSetDigitalDC21040"
2500+
| "dot3ChipSetDigitalDC21140"
2501+
| "dot3ChipSetDigitalDC21041"
2502+
| "dot3ChipSetDigitalDC21140A"
2503+
| "dot3ChipSetDigitalDC21142"
2504+
| "dot3ChipSetWesternDigital83C690"
2505+
| "dot3ChipSetWesternDigital83C790" => true,
2506+
24802507
_ => false,
24812508
}
24822509
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// sys/net/if_mib.h
2+
3+
/// non-interface-specific
4+
pub const IFMIB_SYSTEM: ::c_int = 1;
5+
/// per-interface data table
6+
pub const IFMIB_IFDATA: ::c_int = 2;
7+
8+
/// generic stats for all kinds of ifaces
9+
pub const IFDATA_GENERAL: ::c_int = 1;
10+
/// specific to the type of interface
11+
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
12+
/// driver name and unit
13+
pub const IFDATA_DRIVERNAME: ::c_int = 3;
14+
15+
/// number of interfaces configured
16+
pub const IFMIB_IFCOUNT: ::c_int = 1;
17+
18+
/// functions not specific to a type of iface
19+
pub const NETLINK_GENERIC: ::c_int = 0;
20+
21+
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
22+
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
23+
24+
pub const dot3ChipSetAMD7990: ::c_int = 1;
25+
pub const dot3ChipSetAMD79900: ::c_int = 2;
26+
pub const dot3ChipSetAMD79C940: ::c_int = 3;
27+
28+
pub const dot3ChipSetIntel82586: ::c_int = 1;
29+
pub const dot3ChipSetIntel82596: ::c_int = 2;
30+
pub const dot3ChipSetIntel82557: ::c_int = 3;
31+
32+
pub const dot3ChipSetNational8390: ::c_int = 1;
33+
pub const dot3ChipSetNationalSonic: ::c_int = 2;
34+
35+
pub const dot3ChipSetFujitsu86950: ::c_int = 1;
36+
37+
pub const dot3ChipSetDigitalDC21040: ::c_int = 1;
38+
pub const dot3ChipSetDigitalDC21140: ::c_int = 2;
39+
pub const dot3ChipSetDigitalDC21041: ::c_int = 3;
40+
pub const dot3ChipSetDigitalDC21140A: ::c_int = 4;
41+
pub const dot3ChipSetDigitalDC21142: ::c_int = 5;
42+
43+
pub const dot3ChipSetWesternDigital83C690: ::c_int = 1;
44+
pub const dot3ChipSetWesternDigital83C790: ::c_int = 2;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,51 +3361,6 @@ pub const IFDR_MSG_SIZE: ::c_int = 64;
33613361
pub const IFDR_REASON_MSG: ::c_int = 1;
33623362
pub const IFDR_REASON_VENDOR: ::c_int = 2;
33633363

3364-
// sys/net/if_mib.h
3365-
3366-
/// non-interface-specific
3367-
pub const IFMIB_SYSTEM: ::c_int = 1;
3368-
/// per-interface data table
3369-
pub const IFMIB_IFDATA: ::c_int = 2;
3370-
3371-
/// generic stats for all kinds of ifaces
3372-
pub const IFDATA_GENERAL: ::c_int = 1;
3373-
/// specific to the type of interface
3374-
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
3375-
/// driver name and unit
3376-
pub const IFDATA_DRIVERNAME: ::c_int = 3;
3377-
3378-
/// number of interfaces configured
3379-
pub const IFMIB_IFCOUNT: ::c_int = 1;
3380-
3381-
/// functions not specific to a type of iface
3382-
pub const NETLINK_GENERIC: ::c_int = 0;
3383-
3384-
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
3385-
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
3386-
3387-
pub const dot3ChipSetAMD7990: ::c_int = 1;
3388-
pub const dot3ChipSetAMD79900: ::c_int = 2;
3389-
pub const dot3ChipSetAMD79C940: ::c_int = 3;
3390-
3391-
pub const dot3ChipSetIntel82586: ::c_int = 1;
3392-
pub const dot3ChipSetIntel82596: ::c_int = 2;
3393-
pub const dot3ChipSetIntel82557: ::c_int = 3;
3394-
3395-
pub const dot3ChipSetNational8390: ::c_int = 1;
3396-
pub const dot3ChipSetNationalSonic: ::c_int = 2;
3397-
3398-
pub const dot3ChipSetFujitsu86950: ::c_int = 1;
3399-
3400-
pub const dot3ChipSetDigitalDC21040: ::c_int = 1;
3401-
pub const dot3ChipSetDigitalDC21140: ::c_int = 2;
3402-
pub const dot3ChipSetDigitalDC21041: ::c_int = 3;
3403-
pub const dot3ChipSetDigitalDC21140A: ::c_int = 4;
3404-
pub const dot3ChipSetDigitalDC21142: ::c_int = 5;
3405-
3406-
pub const dot3ChipSetWesternDigital83C690: ::c_int = 1;
3407-
pub const dot3ChipSetWesternDigital83C790: ::c_int = 2;
3408-
34093364
// sys/netinet/in.h
34103365
// Protocols (RFC 1700)
34113366
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
@@ -5749,3 +5704,6 @@ cfg_if! {
57495704
// Unknown target_arch
57505705
}
57515706
}
5707+
5708+
// sys/net/if_mib.h
5709+
pub mod ifmib;

0 commit comments

Comments
 (0)