fix undeclared identifier get_page_size

This commit is contained in:
Lizonghang 2025-01-29 19:59:02 +04:00
parent 4b616baed4
commit 27c996835d

View file

@ -48,6 +48,20 @@
#include <dirent.h>
static size_t get_page_size() {
size_t page_size = 0;
#ifdef _WIN32
SYSTEM_INFO si;
GetSystemInfo(&si);
page_size = si.dwPageSize;
#elif defined(__APPLE__) || defined(__linux__)
page_size = sysconf(_SC_PAGESIZE);
#endif
return page_size;
}
static const char * get_uname_os() {
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("uname -o", "r"), pclose);
if (!pipe) {
@ -728,20 +742,6 @@ uint64_t device_swap_memory(bool available) {
}
}
static size_t get_page_size() {
size_t page_size = 0;
#ifdef _WIN32
SYSTEM_INFO si;
GetSystemInfo(&si);
page_size = si.dwPageSize;
#elif defined(__APPLE__) || defined(__linux__)
page_size = sysconf(_SC_PAGESIZE);
#endif
return page_size;
}
static std::string get_default_device_path() {
#ifdef __linux__
// find the first block device under /sys/block