mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
NetBSD: support CPUUsage / Memory / Swap
This commit is contained in:
+3
-3
@@ -685,7 +685,7 @@ elseif(NetBSD)
|
||||
src/detection/chassis/chassis_nbsd.c
|
||||
src/detection/cpu/cpu_bsd.c
|
||||
src/detection/cpucache/cpucache_nosupport.c
|
||||
src/detection/cpuusage/cpuusage_nosupport.c
|
||||
src/detection/cpuusage/cpuusage_bsd.c
|
||||
src/detection/cursor/cursor_linux.c
|
||||
src/detection/disk/disk_nosupport.c
|
||||
src/detection/dns/dns_linux.c
|
||||
@@ -720,7 +720,7 @@ elseif(NetBSD)
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_nosupport.c
|
||||
src/detection/media/media_linux.c
|
||||
src/detection/memory/memory_bsd.c
|
||||
src/detection/memory/memory_obsd.c
|
||||
src/detection/mouse/mouse_nosupport.c
|
||||
src/detection/netio/netio_nosupport.c
|
||||
src/detection/opengl/opengl_linux.c
|
||||
@@ -730,7 +730,7 @@ elseif(NetBSD)
|
||||
src/detection/processes/processes_nosupport.c
|
||||
src/detection/gtk_qt/qt.c
|
||||
src/detection/sound/sound_nosupport.c
|
||||
src/detection/swap/swap_nosupport.c
|
||||
src/detection/swap/swap_obsd.c
|
||||
src/detection/terminalfont/terminalfont_linux.c
|
||||
src/detection/terminalshell/terminalshell_linux.c
|
||||
src/detection/terminalsize/terminalsize_linux.c
|
||||
|
||||
@@ -6,15 +6,19 @@
|
||||
#include <sys/resource.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#if __OpenBSD__ || __NetBSD__
|
||||
#include <sys/sched.h>
|
||||
#endif
|
||||
|
||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
||||
{
|
||||
size_t neededLength = 0;
|
||||
#ifdef __OpenBSD__
|
||||
int ctls[] = {CTL_KERN, KERN_CPTIME};
|
||||
#if __OpenBSD__|| __NetBSD__
|
||||
#ifdef KERN_CPTIME
|
||||
int ctls[] = {CTL_KERN, KERN_CPTIME};
|
||||
#else
|
||||
int ctls[] = {CTL_KERN, KERN_CP_TIME};
|
||||
#endif
|
||||
if (sysctl(ctls, 2, NULL, &neededLength, NULL, 0) != 0)
|
||||
return "sysctl({CTL_KERN, KERN_CPTIME}, 2, NULL) failed";
|
||||
#else
|
||||
@@ -27,7 +31,7 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
||||
|
||||
FF_AUTO_FREE uint64_t (*cpTimes)[CPUSTATES] = malloc(neededLength);
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#if __OpenBSD__ || __NetBSD__
|
||||
if (sysctl(ctls, 2, cpTimes, &neededLength, NULL, 0) != 0)
|
||||
return "sysctl({CTL_KERN, KERN_CPTIME}, 2, NULL) failed";
|
||||
#else
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#if __NetBSD__
|
||||
#include <uvm/uvm_extern.h>
|
||||
#endif
|
||||
|
||||
const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
{
|
||||
struct uvmexp buf;
|
||||
|
||||
Reference in New Issue
Block a user