Unverified Commit 50fa627b authored by David CARLIER's avatar David CARLIER Committed by GitHub
Browse files

zmalloc_get_rss netbsd impl fix proposal. (#10116)

Seems like the previous implementation was broken (always returning 0)

since kinfo_proc2 is used the KERN_PROC2 sysctl oid is more appropriate
and also the query's length was not necessarily accurate (6 here).
parent 32e7b46a
...@@ -476,12 +476,12 @@ size_t zmalloc_get_rss(void) { ...@@ -476,12 +476,12 @@ size_t zmalloc_get_rss(void) {
size_t infolen = sizeof(info); size_t infolen = sizeof(info);
int mib[6]; int mib[6];
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC; mib[1] = KERN_PROC2;
mib[2] = KERN_PROC_PID; mib[2] = KERN_PROC_PID;
mib[3] = getpid(); mib[3] = getpid();
mib[4] = sizeof(info); mib[4] = sizeof(info);
mib[5] = 1; mib[5] = 1;
if (sysctl(mib, 4, &info, &infolen, NULL, 0) == 0) if (sysctl(mib, __arraycount(mib), &info, &infolen, NULL, 0) == 0)
return (size_t)info.p_vm_rssize * getpagesize(); return (size_t)info.p_vm_rssize * getpagesize();
return 0L; return 0L;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment