Using std::string_view instead of std::string& silences a new warning
from GCC 13, -Wdangling-reference
Also switch return type of `getI` from int& to int, trivial types are
cheaper to copy by value
See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
TLDR: NULL is of type int and relies on proper implicit pointer
conversion which may lead to issues when using overloaded functions
It is also considered a 'best practise' for modern C++ and
conveys the programmers intention more precisly.
Get the load average from libc and adjust the internal API. This has
less overhead than opening /proc/loadavg.
Favor emplace_back over push_back, in general it has the chance to not
create a temporary object.
Correct data types in calls to std::accumulate(). The "bandwidth" deques
have type "long long", so the initial value of the accumulator (0) must
also be "long long" (i.e., "0ll") to prevent integer overflows. Also,
since since the bandwidth deques are (signed) "long long", the avg_speed
should presumably be a signed "long long" instead of an unsigned
"uint64_t". The previous behavior was for large bandwidth values to
overflow the accumulator, resulting in a negative total, which then was
cast to be a huge "uint64_t" value. As a consequence, the network graph
autoscaling was broken for large bandwidths.
Returning from the thread this way prevents local variables to be
destructed correctly since pthread_exit is marked noreturn.
This fixes a segmentation fault with glibc and llvm-libunwind on exit.
check.
Clang cannot handle <semaphore> being included in a namespace, which is
also unadvised see:
https://softwareengineering.stackexchange.com/a/335261.
Using the fallback <semaphore.h> is only meant for GCC 10, but Clang
defines `__GNUC__ = 4` so exclude Clang.
...instead of the last.
Side effect of this is that it also detects when the current IP gets
removed from the interface, instead of keep displaying the old IP.
This is PR #457 but for OSX, not Linux.
... instead of the last.
Side effect of this is that it also detects when the current IP
gets removed from the interface, instead of keep displaying the old IP.
This is PR #457 but for FreeBSD, not Linux.