mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
NetIO (BSD): add txDrops detection if supported
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 <net/if.h>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user