Processes (NetBSD): add support

This commit is contained in:
Carter Li 2024-11-01 00:20:51 +08:00
parent cb403be8e5
commit b410710903
2 changed files with 16 additions and 1 deletions

View File

@ -727,7 +727,7 @@ elseif(NetBSD)
src/detection/os/os_nbsd.c
src/detection/packages/packages_obsd.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_nosupport.c
src/detection/processes/processes_nbsd.c
src/detection/gtk_qt/qt.c
src/detection/sound/sound_linux.c
src/detection/swap/swap_obsd.c

View File

@ -0,0 +1,15 @@
#include "processes.h"
#include <sys/sysctl.h>
const char* ffDetectProcesses(uint32_t* result)
{
int request[] = {CTL_KERN, KERN_PROC2, KERN_PROC_ALL, -1, sizeof(struct kinfo_proc2), 0};
size_t length = 0;
if(sysctl(request, ARRAY_SIZE(request), NULL, &length, NULL, 0) != 0)
return "sysctl({CTL_KERN, KERN_PROC2, KERN_PROC_ALL}) failed";
*result = (uint32_t)(length / sizeof(struct kinfo_proc2));
return NULL;
}