Skip to content

Commit

Permalink
Add NetBSD Support.
Browse files Browse the repository at this point in the history
  • Loading branch information
fraggerfox committed Feb 17, 2024
1 parent fd2a2ac commit 3545de6
Show file tree
Hide file tree
Showing 3 changed files with 1,293 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ else ifeq ($(PLATFORM_LC),openbsd)
override ADDFLAGS += -lkvm -static-libstdc++
export MAKE = gmake
SU_GROUP := wheel
else ifeq ($(PLATFORM_LC),netbsd)
PLATFORM_DIR := netbsd
THREADS := $(shell sysctl -n hw.ncpu || echo 1)
override ADDFLAGS += -lkvm
export MAKE = gmake
SU_GROUP := wheel
else
$(error $(shell printf "\033[1;91mERROR: \033[97mUnsupported platform ($(PLATFORM))\033[0m"))
endif
Expand Down
6 changes: 3 additions & 3 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void clean_quit(int sig) {
Global::quitting = true;
Runner::stop();
if (Global::_runner_started) {
#if defined __APPLE__ || defined __OpenBSD__
#if defined __APPLE__ || defined __OpenBSD__ || defined __NetBSD__
if (pthread_join(Runner::runner_id, nullptr) != 0) {
Logger::warning("Failed to join _runner thread on exit!");
pthread_cancel(Runner::runner_id);
Expand Down Expand Up @@ -311,7 +311,7 @@ void clean_quit(int sig) {

const auto excode = (sig != -1 ? sig : 0);

#if defined __APPLE__ || defined __OpenBSD__
#if defined __APPLE__ || defined __OpenBSD__ || defined __NetBSD__
_Exit(excode);
#else
quick_exit(excode);
Expand Down Expand Up @@ -1006,7 +1006,7 @@ int main(int argc, char **argv) {
Config::set("tty_mode", true);
Logger::info("Forcing tty mode: setting 16 color mode and using tty friendly graph symbols");
}
#if not defined __APPLE__ && not defined __OpenBSD__
#if not defined __APPLE__ && not defined __OpenBSD__ && not defined __NetBSD__
else if (not Global::arg_tty and Term::current_tty.starts_with("/dev/tty")) {
Config::set("tty_mode", true);
Logger::info("Real tty detected: setting 16 color mode and using tty friendly graph symbols");
Expand Down
Loading

0 comments on commit 3545de6

Please sign in to comment.