mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 09:17:20 +00:00
getting rss size implementation for netbsd (#7293)
(cherry picked from commit ce8bfc56ad
)
This commit is contained in:
parent
120c6b43e1
commit
d51bebd4d7
@ -314,6 +314,26 @@ size_t zmalloc_get_rss(void) {
|
||||
|
||||
return 0L;
|
||||
}
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
size_t zmalloc_get_rss(void) {
|
||||
struct kinfo_proc2 info;
|
||||
size_t infolen = sizeof(info);
|
||||
int mib[6];
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC;
|
||||
mib[2] = KERN_PROC_PID;
|
||||
mib[3] = getpid();
|
||||
mib[4] = sizeof(info);
|
||||
mib[5] = 1;
|
||||
if (sysctl(mib, 4, &info, &infolen, NULL, 0) == 0)
|
||||
return (size_t)info.p_vm_rssize;
|
||||
|
||||
return 0L;
|
||||
}
|
||||
#else
|
||||
size_t zmalloc_get_rss(void) {
|
||||
/* If we can't get the RSS in an OS-specific way for this system just
|
||||
|
Loading…
Reference in New Issue
Block a user