Skip to content

Commit b410710

Browse files
committed
Processes (NetBSD): add support
1 parent cb403be commit b410710

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ elseif(NetBSD)
727727
src/detection/os/os_nbsd.c
728728
src/detection/packages/packages_obsd.c
729729
src/detection/poweradapter/poweradapter_nosupport.c
730-
src/detection/processes/processes_nosupport.c
730+
src/detection/processes/processes_nbsd.c
731731
src/detection/gtk_qt/qt.c
732732
src/detection/sound/sound_linux.c
733733
src/detection/swap/swap_obsd.c
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "processes.h"
2+
3+
#include <sys/sysctl.h>
4+
5+
const char* ffDetectProcesses(uint32_t* result)
6+
{
7+
int request[] = {CTL_KERN, KERN_PROC2, KERN_PROC_ALL, -1, sizeof(struct kinfo_proc2), 0};
8+
size_t length = 0;
9+
10+
if(sysctl(request, ARRAY_SIZE(request), NULL, &length, NULL, 0) != 0)
11+
return "sysctl({CTL_KERN, KERN_PROC2, KERN_PROC_ALL}) failed";
12+
13+
*result = (uint32_t)(length / sizeof(struct kinfo_proc2));
14+
return NULL;
15+
}

0 commit comments

Comments
 (0)