diff options
author | Klemens Nanni <klemens@posteo.de> | 2022-01-11 12:27:05 +0300 |
---|---|---|
committer | Klemens Nanni <klemens@posteo.de> | 2022-01-12 00:32:15 +0300 |
commit | ccbacbf0ab68441fe9ab9728d785b9417affb845 (patch) | |
tree | 14480cfe61aa60f6704f3caba3dd6dd580bf4976 | |
parent | 42ad5edf5ab162ddc0b9f0e3ad5eeb192dd95cf4 (diff) |
BUILD(client): Plugin framework: Pass element size to kvm_getprocs(3) on OpenBSD
There is an additional `elemsize` argument
(https://man.openbsd.org/kvm_getprocs.3):
Only the first elemsize bytes of each array entry are returned.
Complete OpenBSD signature:
```
struct kinfo_proc *
kvm_getprocs(kvm_t *kd, int op, int arg, size_t elemsize, int *cnt);
```
Linux, FreeBSD and NetBSD have the same four-argument signature:
```
struct kinfo_proc *
kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt);
```
Build-tested on OpenBSD 7.0-CURRENT.
-rw-r--r-- | src/ProcessResolver.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ProcessResolver.cpp b/src/ProcessResolver.cpp index cacf1ba3e..631cba2fa 100644 --- a/src/ProcessResolver.cpp +++ b/src/ProcessResolver.cpp @@ -250,8 +250,10 @@ void ProcessResolver::doResolve() { } int n_procs; -# if defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(__NetBSD__) struct kinfo_proc *procs_info = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_procs); +# elif defined(__OpenBSD__) + struct kinfo_proc *procs_info = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*procs_info), &n_procs); # else struct kinfo_proc *procs_info = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_procs); # endif |