diff --git a/CHANGELOG.md b/CHANGELOG.md index 1267a3a92..45309bc4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Features: * Detect WM / DE by enumerating running processes (WM / DE, NetBSD) * Generate manual pages from `help.json` (Doc) * Detect marketing name of vivo smartphone (Host, Android) +* Add txDrops detection if supported (NetIO, *BSD) * Support percent type config in module level. Example: ```json diff --git a/CMakeLists.txt b/CMakeLists.txt index fe7a99f2a..9bab8a0a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1180,6 +1180,16 @@ elseif(NetBSD) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib") # ditto endif() +if(FreeBSD OR OpenBSD OR NetBSD) + include(CheckStructHasMember) + set(CMAKE_REQUIRED_DEFINITIONS "-D_IFI_OQDROPS=1") + CHECK_STRUCT_HAS_MEMBER("struct if_data" ifi_oqdrops net/if.h HAVE_IFI_OQDROPS LANGUAGE C) + if(HAVE_IFI_OQDROPS) + target_compile_definitions(libfastfetch PUBLIC _IFI_OQDROPS FF_HAVE_IFI_OQDROPS) + endif() + unset(CMAKE_REQUIRED_DEFINITIONS) +endif() + if(HAVE_STATX) target_compile_definitions(libfastfetch PUBLIC FF_HAVE_STATX) endif() diff --git a/src/detection/netio/netio_bsd.c b/src/detection/netio/netio_bsd.c index 5328949a9..d1e4dbd81 100644 --- a/src/detection/netio/netio_bsd.c +++ b/src/detection/netio/netio_bsd.c @@ -1,8 +1,6 @@ #include "netio.h" -#include "common/io/io.h" #include "common/netif/netif.h" -#include "util/stringUtils.h" #include "util/mallocHelper.h" #include @@ -48,8 +46,8 @@ const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options) .rxPackets = ifm->ifm_data.ifi_ipackets, .txErrors = ifm->ifm_data.ifi_oerrors, .rxErrors = ifm->ifm_data.ifi_ierrors, - #ifdef _IFI_OQDROPS - .txDrops = if2m->ifm_data.ifi_oqdrops, + #ifdef FF_HAVE_IFI_OQDROPS + .txDrops = ifm->ifm_data.ifi_oqdrops, #else .txDrops = 0, // unsupported #endif