Skip to content

Commit

Permalink
Fix freebsd nullptr changes and makefile for gcc12 and newer
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Aug 3, 2023
1 parent 8a33aab commit c8ec6bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ else ifeq ($(PLATFORM_LC),freebsd)
PLATFORM_DIR := freebsd
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
SU_GROUP := wheel
override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc11
override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc$(CXX_VERSION_MAJOR)
export MAKE = gmake
else ifeq ($(PLATFORM_LC),macos)
PLATFORM_DIR := osx
Expand Down
6 changes: 3 additions & 3 deletions src/freebsd/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ namespace Mem {

if (show_swap) {
char buf[_POSIX2_LINE_MAX];
Shared::kvm_openfiles_wrapper kd(nullptr, _PATH_DEVnullptr, nullptr, O_RDONLY, buf);
Shared::kvm_openfiles_wrapper kd(nullptr, _PATH_DEVNULL, nullptr, O_RDONLY, buf);
struct kvm_swap swap[16];
int nswap = kvm_getswapinfo(kd(), swap, 16, 0);
int totalSwap = 0, usedSwap = 0;
Expand Down Expand Up @@ -1157,7 +1157,7 @@ namespace Proc {

int count = 0;
char buf[_POSIX2_LINE_MAX];
Shared::kvm_openfiles_wrapper kd(nullptr, _PATH_DEVnullptr, nullptr, O_RDONLY, buf);
Shared::kvm_openfiles_wrapper kd(nullptr, _PATH_DEVNULL, nullptr, O_RDONLY, buf);
const struct kinfo_proc* kprocs = kvm_getprocs(kd(), KERN_PROC_PROC, 0, &count);

for (int i = 0; i < count; i++) {
Expand All @@ -1179,7 +1179,7 @@ namespace Proc {

//? Get program name, command, username, parent pid, nice and status
if (no_cache) {
if (kproc->ki_comm == nullptr or kproc->ki_comm == "idle"s) {
if (string(kproc->ki_comm) == "idle"s) {
current_procs.pop_back();
found.pop_back();
continue;
Expand Down

0 comments on commit c8ec6bb

Please sign in to comment.