mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Swap (macOS): detect detailed info
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
#include <mach/mach.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
const char* ffDetectSwap(FFSwapResult* swap)
|
||||
const char* ffDetectSwap(FFlist* result)
|
||||
{
|
||||
struct xsw_usage xsw;
|
||||
size_t size = sizeof(xsw);
|
||||
if(sysctl((int[]){ CTL_VM, VM_SWAPUSAGE }, 2, &xsw, &size, NULL, 0) != 0)
|
||||
return "Failed to read vm.swapusage";
|
||||
|
||||
FFSwapResult* swap = ffListAdd(result);
|
||||
ffStrbufInitStatic(&swap->name, xsw.xsu_encrypted ? "Encrypted" : "Normal");
|
||||
swap->bytesTotal = xsw.xsu_total;
|
||||
swap->bytesUsed = xsw.xsu_used;
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user