Global: don't require sysinfo.h globally

... which is Linux specific
This commit is contained in:
李通洲
2022-12-28 17:18:08 +08:00
parent 6ff67e87eb
commit 90359d227e
14 changed files with 25 additions and 54 deletions
+7 -8
View File
@@ -1,12 +1,11 @@
#include "processes.h"
uint32_t ffDetectProcesses(FFinstance* instance, FFstrbuf* error)
#include <sys/sysinfo.h>
uint32_t ffDetectProcesses(FFstrbuf* error)
{
#if FF_HAVE_SYSINFO_H
FF_UNUSED(error);
return (uint32_t) instance->state.sysinfo.procs;
#else
ffStrbufAppendS(error, "Unimplemented");
return 0;
#endif
struct sysinfo info;
if(sysinfo(&info) != 0)
ffStrbufAppendS(error, "sysinfo() failed");
return (uint32_t) info.procs;
}