diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/processes/processes_linux.c | |
Add the files
Diffstat (limited to 'src/detection/processes/processes_linux.c')
| -rw-r--r-- | src/detection/processes/processes_linux.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/detection/processes/processes_linux.c b/src/detection/processes/processes_linux.c new file mode 100644 index 0000000..dee8c09 --- /dev/null +++ b/src/detection/processes/processes_linux.c @@ -0,0 +1,27 @@ +#include "processes.h" + +#include "common/io.h" +#include "common/strutil.h" + +const char* ffDetectProcesses(uint32_t* result) { + FF_AUTO_CLOSE_DIR DIR* dir = opendir("/proc"); + if (dir == NULL) { + return "opendir(\"/proc\") failed"; + } + + uint32_t num = 0; + + struct dirent* entry; + while ((entry = readdir(dir)) != NULL) { + if ( +#ifdef _DIRENT_HAVE_D_TYPE + (entry->d_type == DT_DIR || entry->d_type == DT_UNKNOWN) && +#endif + ffCharIsDigit(entry->d_name[0])) + ++num; + } + + *result = num; + + return NULL; +} |