Add NetBSD Support.

This commit is contained in:
Santhosh Raju 2024-01-06 08:28:11 +01:00
parent dd4ada7023
commit 57c4115282
3 changed files with 1293 additions and 3 deletions

View File

@ -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

View File

@ -293,7 +293,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);
@ -329,7 +329,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);
@ -1024,7 +1024,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");

1284
src/netbsd/btop_collect.cpp Normal file

File diff suppressed because it is too large Load Diff