authorgravatar for devnexen@gmail.comDavid Carlier <devnexen@gmail.com> 2023-04-12 21:07:36+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-13 23:46:03-04:00
log4a0508e56c06456c367c57a7565b9f757f2ff663
tree8826bedcaef63ecde4290297065a4f527d0a1c76
parent5e19250a1251e7857b5679949085fa1fb3f9bdcd

std: add kinfo_vmentry for FreeBSD


1 files changed, 35 insertions(+), 0 deletions(-)

lib/std/c/freebsd.zig+35
...@@ -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;
24pub extern "c" fn getpid() pid_t;24pub extern "c" fn getpid() pid_t;
2525
26pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;26pub extern "c" fn kinfo_getfile(pid: pid_t, cntp: *c_int) ?[*]kinfo_file;
27pub extern "c" fn kinfo_getvmmap(pid: pid_t, cntp: *c_int) ?[*]kinfo_vmentry;
2728
28pub const sf_hdtr = extern struct {29pub 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}
567568
569pub 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
597pub const KINFO_VMENTRY_SIZE = 1160;
598
599comptime {
600 std.debug.assert(@sizeOf(kinfo_vmentry) == KINFO_VMENTRY_SIZE);
601}
602
568pub const CTL = struct {603pub const CTL = struct {
569 pub const KERN = 1;604 pub const KERN = 1;
570 pub const DEBUG = 5;605 pub const DEBUG = 5;