Global: address review comments v2

This commit is contained in:
李通洲
2026-08-31 21:53:32 +08:00
parent 43d01f26ea
commit b0ba084b5e
2 changed files with 5 additions and 5 deletions
+2 -1
View File
@@ -13,7 +13,8 @@ const char* ffDetectProcesses(const FFProcessesOptions* options, FFProcessesResu
}
int count = 0;
// KERN_PROC_ALL returns all user-level processes, excluding kernel processes and threads
// KERN_PROC_ALL returns all user-level processes
// KERN_PROC_KTHREAD returns all processes, including user-level processes (despite the name)
const struct kinfo_proc* procs = kvm_getprocs(kd,
(options->countKprocs ? KERN_PROC_KTHREAD : KERN_PROC_ALL) | KERN_PROC_SHOW_THREADS,
0, sizeof(struct kinfo_proc), &count);
+2 -3
View File
@@ -26,11 +26,10 @@ const char* ffDetectProcesses(const FFProcessesOptions* options, FFProcessesResu
}
for (SYSTEM_PROCESS_INFORMATION* ptr = pstart; ; ptr = (SYSTEM_PROCESS_INFORMATION*) ((uint8_t*) ptr + ptr->NextEntryOffset)) {
if (!options->countKprocs && (uintptr_t) ptr->InheritedFromUniqueProcessId > 0) {
continue;
}
if (options->countKprocs || (uintptr_t) ptr->InheritedFromUniqueProcessId > 0) {
++result->processes;
result->threads += ptr->NumberOfThreads;
}
if (ptr->NextEntryOffset == 0) {
break;
}