mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
ebab281471
`sysinfo.procs` reports number of all running threads, instead of processes
26 lines
466 B
C
26 lines
466 B
C
#include "processes.h"
|
|
|
|
#include "common/io/io.h"
|
|
|
|
#include <ctype.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 (entry->d_type == DT_DIR && isdigit(entry->d_name[0]))
|
|
++num;
|
|
}
|
|
|
|
*result = num;
|
|
|
|
return NULL;
|
|
}
|