master ohmu/fastfetch-openbsd / src / common / sysctl.h
ohmu  ·  2026-10-15
 1#pragma once
 2
 3#include "fastfetch.h"
 4
 5#include <sys/types.h>
 6#include <sys/sysctl.h>
 7
 8// `result` is always written to, and `propName` is always read by the sysctl wrapper.
 9#ifdef __OpenBSD__
10[[gnu::nonnull(3)]] const char* ffSysctlGetString(int mib1, int mib2, FFstrbuf* result);
11[[nodiscard]] int ffSysctlGetInt(int mib1, int mib2, int defaultValue);
12[[nodiscard]] int64_t ffSysctlGetInt64(int mib1, int mib2, int64_t defaultValue);
13#else
14[[gnu::nonnull(1, 2)]] const char* ffSysctlGetString(const char* propName, FFstrbuf* result);
15[[gnu::nonnull(1), nodiscard]] int ffSysctlGetInt(const char* propName, int defaultValue);
16[[gnu::nonnull(1), nodiscard]] int64_t ffSysctlGetInt64(const char* propName, int64_t defaultValue);
17#endif