fix *bsd max memory
Signed-off-by: Unix <100294596+unix-supremacist@users.noreply.github.com>
This commit is contained in:
parent
1b52829e6c
commit
75756a5b9e
@ -66,16 +66,16 @@ uint64_t Sys::getSystemRam()
|
|||||||
// ignore rest of the line
|
// ignore rest of the line
|
||||||
file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
file.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_FREEBSD)
|
#elif defined(Q_OS_OPENBSD) || defined(Q_OS_FREEBSD)
|
||||||
char buff[512];
|
char buff[512];
|
||||||
FILE *fp = popen("sysctl hw.physmem", "r");
|
FILE *fp = popen("sysctl -n hw.physmem", "r");
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
{
|
{
|
||||||
while(fgets(buff, 512, fp) != NULL)
|
while(fgets(buff, 512, fp) != NULL)
|
||||||
{
|
{
|
||||||
std::string str(buff);
|
std::string str(buff);
|
||||||
uint64_t mem = std::stoull(str.substr(12, std::string::npos));
|
uint64_t mem = std::stoull(str);
|
||||||
return mem * 1024ull;
|
return mem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user