mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-06 15:19:07 +00:00
fix undeclared identifier get_page_size
This commit is contained in:
parent
4b616baed4
commit
27c996835d
1 changed files with 14 additions and 14 deletions
|
@ -48,6 +48,20 @@
|
||||||
#include <dirent.h>
|
#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() {
|
static const char * get_uname_os() {
|
||||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("uname -o", "r"), pclose);
|
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("uname -o", "r"), pclose);
|
||||||
if (!pipe) {
|
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() {
|
static std::string get_default_device_path() {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
// find the first block device under /sys/block
|
// find the first block device under /sys/block
|
||||||
|
|
Loading…
Add table
Reference in a new issue