mirror of https://github.com/aristocratos/btop.git
Replace `statvfs64` with `statvfs` and define `_FILE_OFFSET_BITS=64`.
On my musl system statvfs64 is not exposed by default. The musl FAQ recommends against using type64_t types, see: https://wiki.musl-libc.org/faq.html#Q:-Do-I-need-to-define-%3Ccode%3E_LARGEFILE64_SOURCE%3C/code%3E-to-get-64bit-%3Ccode%3Eoff_t%3C/code%3E?. Defining `_FILE_OFFSET_BITS=64` and using type_t lets type_t use the 64 bit interface, see: https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-_005fFILE_005fOFFSET_005fBITS.
This commit is contained in:
parent
7dac8505c4
commit
a2fa9da073
2
Makefile
2
Makefile
|
@ -131,7 +131,7 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main
|
|||
override REQFLAGS := -std=c++20
|
||||
WARNFLAGS := -Wall -Wextra -pedantic
|
||||
OPTFLAGS := -O2 -ftree-vectorize -flto=$(THREADS)
|
||||
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS $(GOODFLAGS) $(ADDFLAGS)
|
||||
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
|
||||
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR)
|
||||
|
|
|
@ -1083,9 +1083,9 @@ 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;
|
||||
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...");
|
||||
struct statvfs vfs;
|
||||
if (statvfs(mountpoint.c_str(), &vfs) < 0) {
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue