3 __FBSDID("$FreeBSD: head/lib/libutil/kinfo_getvmmap.c 186512 2008-12-27 11:12:23Z rwatson $");
5 __RCSID("$NetBSD: kinfo_getvmmap.c,v 1.3 2015/09/26 20:28:55 christos Exp $");
9 #include <sys/sysctl.h>
13 #include <uvm/uvm_param.h>
15 struct kinfo_vmentry
*
16 kinfo_getvmmap(pid_t pid
, size_t *cntp
)
21 struct kinfo_vmentry
*kiv
;
29 mib
[4] = sizeof(*kiv
);
31 error
= sysctl(mib
, (u_int
)__arraycount(mib
), NULL
, &len
, NULL
, 0);
41 error
= sysctl(mib
, (u_int
)__arraycount(mib
), kiv
, &len
, NULL
, 0);
47 *cntp
= len
/ sizeof(*kiv
);
48 return kiv
; /* Caller must free() return value */