Files
fastfetch/src/detection/swap/swap_linux.c
T
2023-05-11 22:03:18 +08:00

16 lines
350 B
C

#include "swap.h"
#include <sys/sysinfo.h>
const char* ffDetectSwap(FFSwapResult* swap)
{
struct sysinfo info;
if(sysinfo(&info) != 0)
return "sysinfo() failed";
swap->bytesTotal = info.totalswap * (uint64_t) info.mem_unit;
swap->bytesUsed = (info.totalswap - info.freeswap) * (uint64_t) info.mem_unit;
return NULL;
}