mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-10 07:00:08 +01:00
e0eba8ce21
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
19 lines
597 B
C
19 lines
597 B
C
#include "memory.h"
|
|
#include "common/sysctl.h"
|
|
|
|
#include <sys/param.h>
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
const char* ffDetectMemory(FFMemoryResult* ram) {
|
|
struct uvmexp_sysctl buf;
|
|
size_t length = sizeof(buf);
|
|
if (sysctl((int[]) {CTL_VM, VM_UVMEXP2}, 2, &buf, &length, NULL, 0) < 0) {
|
|
return "sysctl(CTL_VM, VM_UVMEXP2) failed";
|
|
}
|
|
|
|
ram->bytesTotal = (uint64_t) buf.npages * instance.state.platform.sysinfo.pageSize;
|
|
ram->bytesUsed = ((uint64_t) buf.active + (uint64_t) buf.inactive + (uint64_t) buf.wired) * instance.state.platform.sysinfo.pageSize;
|
|
|
|
return NULL;
|
|
}
|