only use 64 bit variant of statvfs if supported

This commit is contained in:
Xea 2023-06-14 22:12:32 +00:00
parent e269046d3b
commit 0bbd56fed0
1 changed files with 6 additions and 1 deletions

View File

@ -1083,9 +1083,14 @@ namespace Mem {
bool new_ignored = false;
for (auto& [mountpoint, disk] : disks) {
if (std::error_code ec; not fs::exists(mountpoint, ec) or v_contains(ignore_list, mountpoint)) continue;
#if defined(_LARGEFILE64_SOURCE) || defined(__USE_LARGEFILE64)
struct statvfs64 vfs;
if (statvfs64(mountpoint.c_str(), &vfs) < 0) {
Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs64 error code: " + to_string(errno) + ". Ignoring...");
#else
struct statvfs vfs;
if (statvfs(mountpoint.c_str(), &vfs) < 0) {
#endif
Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs error code: " + to_string(errno) + ". Ignoring...");
ignore_list.push_back(mountpoint);
new_ignored = true;
continue;