File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Bugfixes:
1515* Fix possible crashes caused by uninitialized strings (Users, Windows)
1616* Improve support of ` --help *-format ` and several bugs are found and fixed
1717* Don't incorrectly print ` No active sound devices found ` when using a non-controllable sound device (Sound, macOS)
18+ * Fix implementation processes counting (Processes, Linux)
1819
1920Logo:
2021* Add Chimera Linux
Original file line number Diff line number Diff line change 11#include "processes.h"
22
3- #include <sys/sysinfo.h>
3+ #include "common/io/io.h"
4+
5+ #include <ctype.h>
46
57const char * ffDetectProcesses (uint32_t * result )
68{
7- struct sysinfo info ;
8- if (sysinfo (& info ) != 0 )
9- return "sysinfo() failed" ;
9+ FF_AUTO_CLOSE_DIR DIR * dir = opendir ("/proc" );
10+ if (dir == NULL )
11+ return "opendir(\"/proc\") failed" ;
12+
13+ uint32_t num = 0 ;
14+
15+ struct dirent * entry ;
16+ while ((entry = readdir (dir )) != NULL )
17+ {
18+ if (entry -> d_type == DT_DIR && isdigit (entry -> d_name [0 ]))
19+ ++ num ;
20+ }
21+
22+ * result = num ;
1023
11- * result = (uint32_t ) info .procs ;
1224 return NULL ;
1325}
You can’t perform that action at this time.
0 commit comments