zmalloc_get_rss openbsd implementation (#10149)

Add support for getting the RSS in OpenBSD
This commit is contained in:
David CARLIER 2022-01-19 18:56:12 +00:00 committed by GitHub
parent 3720de78c9
commit 834fa5870c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -467,10 +467,16 @@ size_t zmalloc_get_rss(void) {
return 0L; return 0L;
} }
#elif defined(__NetBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#if defined(__OpenBSD__)
#define kinfo_proc2 kinfo_proc
#define KERN_PROC2 KERN_PROC
#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
#endif
size_t zmalloc_get_rss(void) { size_t zmalloc_get_rss(void) {
struct kinfo_proc2 info; struct kinfo_proc2 info;
size_t infolen = sizeof(info); size_t infolen = sizeof(info);