mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 10:02:49 +01:00
16 lines
350 B
C
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;
|
|
}
|