| ... | @@ -24,6 +24,7 @@ pub extern "c" fn malloc_usable_size(?*const anyopaque) usize; | ... | @@ -24,6 +24,7 @@ pub extern "c" fn malloc_usable_size(?*const anyopaque) usize; |
| 24 | pub extern "c" fn getpid() pid_t; | 24 | pub extern "c" fn getpid() pid_t; |
| 25 | | 25 | |
| 26 | pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file; | 26 | pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file; |
| | 27 | pub extern "c" fn kinfo_getvmmap(pid: pid_t, cntp: *c_int) ?[*]kinfo_vmentry; |
| 27 | | 28 | |
| 28 | pub const sf_hdtr = extern struct { | 29 | pub const sf_hdtr = extern struct { |
| 29 | headers: [*]const iovec_const, | 30 | headers: [*]const iovec_const, |
| ... | @@ -565,6 +566,40 @@ comptime { | ... | @@ -565,6 +566,40 @@ comptime { |
| 565 | std.debug.assert(@alignOf(kinfo_file) == @sizeOf(u64)); | 566 | std.debug.assert(@alignOf(kinfo_file) == @sizeOf(u64)); |
| 566 | } | 567 | } |
| 567 | | 568 | |
| | 569 | pub const kinfo_vmentry = extern struct { |
| | 570 | kve_structsize: c_int, |
| | 571 | kve_type: c_int, |
| | 572 | kve_start: u64, |
| | 573 | kve_end: u64, |
| | 574 | kve_offset: u64, |
| | 575 | kve_vn_fileid: u64, |
| | 576 | kve_vn_fsid_freebsd11: u32, |
| | 577 | kve_flags: c_int, |
| | 578 | kve_resident: c_int, |
| | 579 | kve_private_resident: c_int, |
| | 580 | kve_protection: c_int, |
| | 581 | kve_ref_count: c_int, |
| | 582 | kve_shadow_count: c_int, |
| | 583 | kve_vn_type: c_int, |
| | 584 | kve_vn_size: u64, |
| | 585 | kve_vn_rdev_freebsd11: u32, |
| | 586 | kve_vn_mode: u16, |
| | 587 | kve_status: u16, |
| | 588 | kve_type_spec: extern union { |
| | 589 | _kve_vn_fsid: u64, |
| | 590 | _kve_obj: u64, |
| | 591 | }, |
| | 592 | kve_vn_rdev: u64, |
| | 593 | _kve_ispare: [8]c_int, |
| | 594 | kve_rpath: [PATH_MAX]u8, |
| | 595 | }; |
| | 596 | |
| | 597 | pub const KINFO_VMENTRY_SIZE = 1160; |
| | 598 | |
| | 599 | comptime { |
| | 600 | std.debug.assert(@sizeOf(kinfo_vmentry) == KINFO_VMENTRY_SIZE); |
| | 601 | } |
| | 602 | |
| 568 | pub const CTL = struct { | 603 | pub const CTL = struct { |
| 569 | pub const KERN = 1; | 604 | pub const KERN = 1; |
| 570 | pub const DEBUG = 5; | 605 | pub const DEBUG = 5; |