diff options
author | Robert Adam <dev@robert-adam.de> | 2022-01-12 11:25:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 11:25:02 +0300 |
commit | 91c6fcd5cbae2af195e679490969d06e3d32f545 (patch) | |
tree | 1d0806cf12611a72a2991e067149002a1e3cd9ed | |
parent | 6a0bcabdbd14242ba54b22b8a3fab876b3a42c74 (diff) | |
parent | a707213aa1f6c635af1fb69bd7f5c06eca29a25d (diff) |
Merge PR #5416: BUILD(client): Plugin Framework: Fix build on NetBSD and OpenBSD
-rw-r--r-- | src/ProcessResolver.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ProcessResolver.cpp b/src/ProcessResolver.cpp index ebd26815d..935598034 100644 --- a/src/ProcessResolver.cpp +++ b/src/ProcessResolver.cpp @@ -239,7 +239,7 @@ void ProcessResolver::doResolve() { # ifdef KVM_NO_FILES kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, error); # else - kvm_t *kd = kvm_openfiles(NULL, _PATH_DEVNULL, NULL, O_RDONLY, error); + kvm_t *kd = kvm_openfiles(NULL, _PATH_DEVNULL, NULL, O_RDONLY, error); # endif if (!kd) { @@ -250,7 +250,13 @@ void ProcessResolver::doResolve() { } int n_procs; +# 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 if (!procs_info) { # ifndef QT_NO_DEBUG qCritical("ProcessResolver: kvm_getprocs() failed\n"); @@ -261,7 +267,11 @@ void ProcessResolver::doResolve() { } for (int i = 0; i < n_procs; ++i) { +# if defined(__NetBSD__) || defined(__OpenBSD__) + addEntry(procs_info[i].p_pid, procs_info[i].p_comm, m_processMap); +# else addEntry(procs_info[i].ki_pid, procs_info[i].ki_comm, m_processMap); +# endif } kvm_cleanup(kd); |