Skip to content

Commit 5020c76

Browse files
authored
Merge pull request #3801 from devnexen/fbsd_kinfo_upd_3
freebsd moving the kinfo_file type to general use.
2 parents 2c935f8 + 34942a5 commit 5020c76

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
@@ -1981,6 +1981,7 @@ kcmp
19811981
kevent
19821982
key_t
19831983
killpg
1984+
kinfo_file
19841985
kinfo_getvmmap
19851986
kinfo_proc
19861987
kinfo_vmentry

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

+63
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,23 @@ s_no_extra_traits! {
16211621
pub cause: sctp_error_cause,
16221622
pub hmac_id: u16,
16231623
}
1624+
1625+
pub struct kinfo_file {
1626+
pub kf_structsize: ::c_int,
1627+
pub kf_type: ::c_int,
1628+
pub kf_fd: ::c_int,
1629+
pub kf_ref_count: ::c_int,
1630+
pub kf_flags: ::c_int,
1631+
_kf_pad0: ::c_int,
1632+
pub kf_offset: i64,
1633+
_priv: [::uintptr_t; 38], // FIXME if needed
1634+
pub kf_status: u16,
1635+
_kf_pad1: u16,
1636+
_kf_ispare0: ::c_int,
1637+
pub kf_cap_rights: ::cap_rights_t,
1638+
_kf_cap_spare: u64,
1639+
pub kf_path: [::c_char; ::PATH_MAX as usize],
1640+
}
16241641
}
16251642

16261643
cfg_if! {
@@ -2529,6 +2546,52 @@ cfg_if! {
25292546
{self.hmac_id}.hash(state);
25302547
}
25312548
}
2549+
2550+
impl PartialEq for kinfo_file {
2551+
fn eq(&self, other: &kinfo_file) -> bool {
2552+
self.kf_structsize == other.kf_structsize &&
2553+
self.kf_type == other.kf_type &&
2554+
self.kf_fd == other.kf_fd &&
2555+
self.kf_ref_count == other.kf_ref_count &&
2556+
self.kf_flags == other.kf_flags &&
2557+
self.kf_offset == other.kf_offset &&
2558+
self.kf_status == other.kf_status &&
2559+
self.kf_cap_rights == other.kf_cap_rights &&
2560+
self.kf_path
2561+
.iter()
2562+
.zip(other.kf_path.iter())
2563+
.all(|(a,b)| a == b)
2564+
}
2565+
}
2566+
impl Eq for kinfo_file {}
2567+
impl ::fmt::Debug for kinfo_file {
2568+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
2569+
f.debug_struct("kinfo_file")
2570+
.field("kf_structsize", &self.kf_structsize)
2571+
.field("kf_type", &self.kf_type)
2572+
.field("kf_fd", &self.kf_fd)
2573+
.field("kf_ref_count", &self.kf_ref_count)
2574+
.field("kf_flags", &self.kf_flags)
2575+
.field("kf_offset", &self.kf_offset)
2576+
.field("kf_status", &self.kf_status)
2577+
.field("kf_cap_rights", &self.kf_cap_rights)
2578+
.field("kf_path", &&self.kf_path[..])
2579+
.finish()
2580+
}
2581+
}
2582+
impl ::hash::Hash for kinfo_file {
2583+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
2584+
self.kf_structsize.hash(state);
2585+
self.kf_type.hash(state);
2586+
self.kf_fd.hash(state);
2587+
self.kf_ref_count.hash(state);
2588+
self.kf_flags.hash(state);
2589+
self.kf_offset.hash(state);
2590+
self.kf_status.hash(state);
2591+
self.kf_cap_rights.hash(state);
2592+
self.kf_path.hash(state);
2593+
}
2594+
}
25322595
}
25332596
}
25342597

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

+2
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,5 @@ cfg_if! {
190190
}
191191

192192
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
193+
194+
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
@@ -91,23 +91,6 @@ s_no_extra_traits! {
9191
pub a_type: ::c_long,
9292
pub a_un: __c_anonymous_elf64_auxv_union,
9393
}
94-
95-
pub struct kinfo_file {
96-
pub kf_structsize: ::c_int,
97-
pub kf_type: ::c_int,
98-
pub kf_fd: ::c_int,
99-
pub kf_ref_count: ::c_int,
100-
pub kf_flags: ::c_int,
101-
_kf_pad0: ::c_int,
102-
pub kf_offset: i64,
103-
_priv: [::uintptr_t; 38], // FIXME if needed
104-
pub kf_status: u16,
105-
_kf_pad1: u16,
106-
_kf_ispare0: ::c_int,
107-
pub kf_cap_rights: ::cap_rights_t,
108-
_kf_cap_spare: u64,
109-
pub kf_path: [::c_char; ::PATH_MAX as usize],
110-
}
11194
}
11295

11396
cfg_if! {
@@ -232,52 +215,6 @@ cfg_if! {
232215
.finish()
233216
}
234217
}
235-
236-
impl PartialEq for kinfo_file {
237-
fn eq(&self, other: &kinfo_file) -> bool {
238-
self.kf_structsize == other.kf_structsize &&
239-
self.kf_type == other.kf_type &&
240-
self.kf_fd == other.kf_fd &&
241-
self.kf_ref_count == other.kf_ref_count &&
242-
self.kf_flags == other.kf_flags &&
243-
self.kf_offset == other.kf_offset &&
244-
self.kf_status == other.kf_status &&
245-
self.kf_cap_rights == other.kf_cap_rights &&
246-
self.kf_path
247-
.iter()
248-
.zip(other.kf_path.iter())
249-
.all(|(a,b)| a == b)
250-
}
251-
}
252-
impl Eq for kinfo_file {}
253-
impl ::fmt::Debug for kinfo_file {
254-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
255-
f.debug_struct("kinfo_file")
256-
.field("kf_structsize", &self.kf_structsize)
257-
.field("kf_type", &self.kf_type)
258-
.field("kf_fd", &self.kf_fd)
259-
.field("kf_ref_count", &self.kf_ref_count)
260-
.field("kf_flags", &self.kf_flags)
261-
.field("kf_offset", &self.kf_offset)
262-
.field("kf_status", &self.kf_status)
263-
.field("kf_cap_rights", &self.kf_cap_rights)
264-
.field("kf_path", &&self.kf_path[..])
265-
.finish()
266-
}
267-
}
268-
impl ::hash::Hash for kinfo_file {
269-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
270-
self.kf_structsize.hash(state);
271-
self.kf_type.hash(state);
272-
self.kf_fd.hash(state);
273-
self.kf_ref_count.hash(state);
274-
self.kf_flags.hash(state);
275-
self.kf_offset.hash(state);
276-
self.kf_status.hash(state);
277-
self.kf_cap_rights.hash(state);
278-
self.kf_path.hash(state);
279-
}
280-
}
281218
}
282219
}
283220

@@ -297,5 +234,7 @@ pub const _MC_FPOWNED_NONE: c_long = 0x20000;
297234
pub const _MC_FPOWNED_FPU: c_long = 0x20001;
298235
pub const _MC_FPOWNED_PCB: c_long = 0x20002;
299236

237+
pub const KINFO_FILE_SIZE: ::c_int = 1392;
238+
300239
mod align;
301240
pub use self::align::*;

0 commit comments

Comments
 (0)