Skip to content

Commit 950827b

Browse files
committedJan 21, 2023
Add struct ctl_info for Apple
1 parent ad3ce34 commit 950827b

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed
 

‎build.rs

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ fn main() {
8383
println!("cargo:rustc-cfg=libc_non_exhaustive");
8484
}
8585

86+
// Rust >= 1.47 supports long array:
87+
if rustc_minor_ver >= 47 || rustc_dep_of_std {
88+
println!("cargo:rustc-cfg=libc_long_array");
89+
}
90+
8691
if rustc_minor_ver >= 51 || rustc_dep_of_std {
8792
println!("cargo:rustc-cfg=libc_ptr_addr_of");
8893
}

‎libc-test/semver/apple.txt

+2
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ CTLFLAG_RD
266266
CTLFLAG_RW
267267
CTLFLAG_SECURE
268268
CTLFLAG_WR
269+
CTLIOCGINFO
269270
CTLTYPE
270271
CTLTYPE_INT
271272
CTLTYPE_NODE
@@ -1844,6 +1845,7 @@ copyfile
18441845
copyfile_flags_t
18451846
cpu_subtype_t
18461847
cpu_type_t
1848+
ctl_info
18471849
difftime
18481850
dirfd
18491851
disconnectx

‎src/unix/bsd/apple/long_array.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
s! {
2+
pub struct ctl_info {
3+
pub ctl_id: u32,
4+
pub ctl_name: [::c_char; MAX_KCTL_NAME],
5+
}
6+
}
7+
8+
pub const MAX_KCTL_NAME: usize = 96;

‎src/unix/bsd/apple/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,8 @@ pub const MINCORE_MODIFIED: ::c_int = 0x4;
33133313
pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
33143314
pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
33153315

3316+
pub const CTLIOCGINFO: c_ulong = 0xc0644e03;
3317+
33163318
//
33173319
// sys/netinet/in.h
33183320
// Protocols (RFC 1700)
@@ -5931,3 +5933,10 @@ cfg_if! {
59315933
// Unknown target_arch
59325934
}
59335935
}
5936+
5937+
cfg_if! {
5938+
if #[cfg(libc_long_array)] {
5939+
mod long_array;
5940+
pub use self::long_array::*;
5941+
}
5942+
}

0 commit comments

Comments
 (0)
Please sign in to comment.