Skip to content

Commit c224f48

Browse files
devnexentgross35
authored andcommitted
freebsd moving the kinfo_file type to general use.
but keeping the constant KINFO_FILE_SIZE for intel archs only. [Resolved conflicts - Trevor] (backport <rust-lang#3801>) (cherry picked from commit 34942a5) Signed-off-by: Trevor Gross <[email protected]>
1 parent c27c43f commit c224f48

File tree

5 files changed

+69
-63
lines changed

5 files changed

+69
-63
lines changed

libc-test/semver/freebsd-x86_64.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Elf64_Auxinfo
2+
KINFO_FILE_SIZE
23
MAP_32BIT
34
_MC_FLAG_MASK
45
_MC_FPFMT_NODEV

libc-test/semver/freebsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,7 @@ jrand48
19771977
kevent
19781978
key_t
19791979
killpg
1980+
kinfo_file
19801981
kinfo_getvmmap
19811982
kinfo_proc
19821983
kinfo_vmentry

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

+63
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,23 @@ s_no_extra_traits! {
16371637
pub cause: sctp_error_cause,
16381638
pub hmac_id: u16,
16391639
}
1640+
1641+
pub struct kinfo_file {
1642+
pub kf_structsize: ::c_int,
1643+
pub kf_type: ::c_int,
1644+
pub kf_fd: ::c_int,
1645+
pub kf_ref_count: ::c_int,
1646+
pub kf_flags: ::c_int,
1647+
_kf_pad0: ::c_int,
1648+
pub kf_offset: i64,
1649+
_priv: [::uintptr_t; 38], // FIXME if needed
1650+
pub kf_status: u16,
1651+
_kf_pad1: u16,
1652+
_kf_ispare0: ::c_int,
1653+
pub kf_cap_rights: ::cap_rights_t,
1654+
_kf_cap_spare: u64,
1655+
pub kf_path: [::c_char; ::PATH_MAX as usize],
1656+
}
16401657
}
16411658

16421659
cfg_if! {
@@ -2593,6 +2610,52 @@ cfg_if! {
25932610
{self.hmac_id}.hash(state);
25942611
}
25952612
}
2613+
2614+
impl PartialEq for kinfo_file {
2615+
fn eq(&self, other: &kinfo_file) -> bool {
2616+
self.kf_structsize == other.kf_structsize &&
2617+
self.kf_type == other.kf_type &&
2618+
self.kf_fd == other.kf_fd &&
2619+
self.kf_ref_count == other.kf_ref_count &&
2620+
self.kf_flags == other.kf_flags &&
2621+
self.kf_offset == other.kf_offset &&
2622+
self.kf_status == other.kf_status &&
2623+
self.kf_cap_rights == other.kf_cap_rights &&
2624+
self.kf_path
2625+
.iter()
2626+
.zip(other.kf_path.iter())
2627+
.all(|(a,b)| a == b)
2628+
}
2629+
}
2630+
impl Eq for kinfo_file {}
2631+
impl ::fmt::Debug for kinfo_file {
2632+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
2633+
f.debug_struct("kinfo_file")
2634+
.field("kf_structsize", &self.kf_structsize)
2635+
.field("kf_type", &self.kf_type)
2636+
.field("kf_fd", &self.kf_fd)
2637+
.field("kf_ref_count", &self.kf_ref_count)
2638+
.field("kf_flags", &self.kf_flags)
2639+
.field("kf_offset", &self.kf_offset)
2640+
.field("kf_status", &self.kf_status)
2641+
.field("kf_cap_rights", &self.kf_cap_rights)
2642+
.field("kf_path", &&self.kf_path[..])
2643+
.finish()
2644+
}
2645+
}
2646+
impl ::hash::Hash for kinfo_file {
2647+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
2648+
self.kf_structsize.hash(state);
2649+
self.kf_type.hash(state);
2650+
self.kf_fd.hash(state);
2651+
self.kf_ref_count.hash(state);
2652+
self.kf_flags.hash(state);
2653+
self.kf_offset.hash(state);
2654+
self.kf_status.hash(state);
2655+
self.kf_cap_rights.hash(state);
2656+
self.kf_path.hash(state);
2657+
}
2658+
}
25962659
}
25972660
}
25982661

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

+2
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,5 @@ cfg_if! {
199199
}
200200

201201
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
202+
203+
pub const KINFO_FILE_SIZE: ::c_int = 1392;

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

+2-63
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,6 @@ s_no_extra_traits! {
9393
#[cfg(libc_union)]
9494
pub a_un: __c_anonymous_elf64_auxv_union,
9595
}
96-
97-
pub struct kinfo_file {
98-
pub kf_structsize: ::c_int,
99-
pub kf_type: ::c_int,
100-
pub kf_fd: ::c_int,
101-
pub kf_ref_count: ::c_int,
102-
pub kf_flags: ::c_int,
103-
_kf_pad0: ::c_int,
104-
pub kf_offset: i64,
105-
_priv: [::uintptr_t; 38], // FIXME if needed
106-
pub kf_status: u16,
107-
_kf_pad1: u16,
108-
_kf_ispare0: ::c_int,
109-
pub kf_cap_rights: ::cap_rights_t,
110-
_kf_cap_spare: u64,
111-
pub kf_path: [::c_char; ::PATH_MAX as usize],
112-
}
11396
}
11497

11598
cfg_if! {
@@ -253,52 +236,6 @@ cfg_if! {
253236
.finish()
254237
}
255238
}
256-
257-
impl PartialEq for kinfo_file {
258-
fn eq(&self, other: &kinfo_file) -> bool {
259-
self.kf_structsize == other.kf_structsize &&
260-
self.kf_type == other.kf_type &&
261-
self.kf_fd == other.kf_fd &&
262-
self.kf_ref_count == other.kf_ref_count &&
263-
self.kf_flags == other.kf_flags &&
264-
self.kf_offset == other.kf_offset &&
265-
self.kf_status == other.kf_status &&
266-
self.kf_cap_rights == other.kf_cap_rights &&
267-
self.kf_path
268-
.iter()
269-
.zip(other.kf_path.iter())
270-
.all(|(a,b)| a == b)
271-
}
272-
}
273-
impl Eq for kinfo_file {}
274-
impl ::fmt::Debug for kinfo_file {
275-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
276-
f.debug_struct("kinfo_file")
277-
.field("kf_structsize", &self.kf_structsize)
278-
.field("kf_type", &self.kf_type)
279-
.field("kf_fd", &self.kf_fd)
280-
.field("kf_ref_count", &self.kf_ref_count)
281-
.field("kf_flags", &self.kf_flags)
282-
.field("kf_offset", &self.kf_offset)
283-
.field("kf_status", &self.kf_status)
284-
.field("kf_cap_rights", &self.kf_cap_rights)
285-
.field("kf_path", &&self.kf_path[..])
286-
.finish()
287-
}
288-
}
289-
impl ::hash::Hash for kinfo_file {
290-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
291-
self.kf_structsize.hash(state);
292-
self.kf_type.hash(state);
293-
self.kf_fd.hash(state);
294-
self.kf_ref_count.hash(state);
295-
self.kf_flags.hash(state);
296-
self.kf_offset.hash(state);
297-
self.kf_status.hash(state);
298-
self.kf_cap_rights.hash(state);
299-
self.kf_path.hash(state);
300-
}
301-
}
302239
}
303240
}
304241

@@ -326,6 +263,8 @@ pub const _MC_FPOWNED_NONE: c_long = 0x20000;
326263
pub const _MC_FPOWNED_FPU: c_long = 0x20001;
327264
pub const _MC_FPOWNED_PCB: c_long = 0x20002;
328265

266+
pub const KINFO_FILE_SIZE: ::c_int = 1392;
267+
329268
cfg_if! {
330269
if #[cfg(libc_align)] {
331270
mod align;

0 commit comments

Comments
 (0)