diff options
author | kz6fittycent <jimmy.tigert@gmail.com> | 2024-03-13 11:02:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 11:02:55 -0500 |
commit | 8af8389bd0791b37148ccec63db74fa353e93d12 (patch) | |
tree | 9ccab871bb998a9cc6c94332cc603e0fb32c3e8c | |
parent | adaea59a2a88e42513db3c3924c489d4cc2063bb (diff) | |
parent | c767099d765b0094c50b8c66030aeacff26f56ef (diff) |
Merge branch 'aristocratos:main' into main
66 files changed, 3170 insertions, 3287 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7ed6a21..e4096cb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,10 +28,9 @@ Any bug that can be solved by just reading the [prerequisites](https://github.co [If applicable, add screenshots to help explain your problem.] **Info (please complete the following information):** - - btop++ version: `btop -v` + - btop++ version: `btop --version` - If using snap: `snap info btop` - Binary: [self compiled or static binary from release] - - (If compiled) Compiler and version: - Architecture: [x86_64, aarch64, etc.] `uname -m` - Platform: [Linux, FreeBSD, OsX] - (Linux) Kernel: `uname -r` diff --git a/.github/workflows/cmake-freebsd.yml b/.github/workflows/cmake-freebsd.yml index 6e687f1..3f1c962 100644 --- a/.github/workflows/cmake-freebsd.yml +++ b/.github/workflows/cmake-freebsd.yml @@ -33,8 +33,7 @@ jobs: with: release: '14.0' usesh: true - prepare: pkg install -y cmake ninja + prepare: pkg install -y cmake ninja lowdown run: | CXX=clang++ cmake -B build -G Ninja -DBTOP_STATIC=ON cmake --build build --verbose - diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index 49754d9..7864a04 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -30,11 +30,10 @@ jobs: - uses: actions/checkout@v4 - name: Install build tools - run: apk add --no-cache --update clang cmake lld ninja + run: apk add --no-cache --update clang cmake lld ninja lowdown - name: Configure run: CXX=clang++ LDFLAGS=-fuse-ld=lld cmake -B build -G Ninja -DBTOP_STATIC=ON - name: Compile run: cmake --build build --verbose - diff --git a/.github/workflows/cmake-macos.yml b/.github/workflows/cmake-macos.yml index 32d6f7f..ee2ef97 100644 --- a/.github/workflows/cmake-macos.yml +++ b/.github/workflows/cmake-macos.yml @@ -32,7 +32,7 @@ jobs: run: | export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew update --quiet - brew install --force --overwrite cmake llvm@17 ninja + brew install --force --overwrite cmake llvm@17 ninja lowdown - name: Configure run: | @@ -44,4 +44,3 @@ jobs: - name: Compile run: cmake --build build --verbose - diff --git a/.github/workflows/continuous-build-freebsd.yml b/.github/workflows/continuous-build-freebsd.yml index 041133f..5521ff7 100644 --- a/.github/workflows/continuous-build-freebsd.yml +++ b/.github/workflows/continuous-build-freebsd.yml @@ -11,6 +11,7 @@ on: - 'src/**' - '!src/linux/**' - '!src/osx/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-freebsd.yml' @@ -21,6 +22,7 @@ on: - 'src/**' - '!src/linux/**' - '!src/osx/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-freebsd.yml' @@ -43,7 +45,7 @@ jobs: release: '14.0' usesh: true prepare: | - pkg install -y gmake gcc coreutils git + pkg install -y gmake gcc coreutils git lowdown git config --global --add safe.directory /home/runner/work/btop/btop run: | CXX=${{ matrix.compiler }} gmake STATIC=true STRIP=true @@ -57,4 +59,3 @@ jobs: name: btop-x86_64-freebsd-14 path: 'bin/*' if-no-files-found: error - diff --git a/.github/workflows/continuous-build-gpu.yml b/.github/workflows/continuous-build-gpu.yml new file mode 100644 index 0000000..e3bdf01 --- /dev/null +++ b/.github/workflows/continuous-build-gpu.yml @@ -0,0 +1,45 @@ +name: Continuous Build Gpu + +on: + workflow_dispatch: + push: + branches: + - main + tags-ignore: + - '*.*' + paths: + - 'src/**' + - '!src/osx/**' + - '!src/freebsd/**' + - '!src/openbsd/**' + - 'include/**' + - 'Makefile' + - '.github/workflows/continuous-build-gpu.yml' + pull_request: + branches: + - main + paths: + - 'src/**' + - '!src/osx/**' + - '!src/freebsd/**' + - '!src/openbsd/**' + - 'include/**' + - 'Makefile' + - '.github/workflows/continuous-build-gpu.yml' + +jobs: + gpu_build_linux: + runs-on: ubuntu-latest + container: alpine:edge + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + + - name: Install build tools + run: apk add --no-cache --update gcc g++ make + + - name: Compile + run: make CXX=g++ GPU_SUPPORT=true + diff --git a/.github/workflows/continuous-build-linux.yml b/.github/workflows/continuous-build-linux.yml index 3ef236c..39de640 100644 --- a/.github/workflows/continuous-build-linux.yml +++ b/.github/workflows/continuous-build-linux.yml @@ -11,6 +11,7 @@ on: - 'src/**' - '!src/osx/**' - '!src/freebsd/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-linux.yml' @@ -21,6 +22,7 @@ on: - 'src/**' - '!src/osx/**' - '!src/freebsd/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-linux.yml' diff --git a/.github/workflows/continuous-build-macos.yml b/.github/workflows/continuous-build-macos.yml index 717e9a7..c8915dd 100644 --- a/.github/workflows/continuous-build-macos.yml +++ b/.github/workflows/continuous-build-macos.yml @@ -11,6 +11,7 @@ on: - 'src/**' - '!src/linux/**' - '!src/freebsd/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-macos.yml' @@ -21,6 +22,7 @@ on: - 'src/**' - '!src/linux/**' - '!src/freebsd/**' + - '!src/openbsd/**' - 'include/**' - 'Makefile' - '.github/workflows/continuous-build-macos.yml' @@ -44,18 +46,18 @@ jobs: with: name: btop-x86_64-macos11-BigSur path: 'bin/*' - + build-macos12: runs-on: macos-12 steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest-stable + xcode-version: latest-stable - uses: actions/checkout@v3 with: submodules: recursive - + - name: Compile run: | make CXX=g++-12 ARCH=x86_64 STATIC=true STRIP=true diff --git a/.github/workflows/continuous-build-openbsd.yml b/.github/workflows/continuous-build-openbsd.yml new file mode 100644 index 0000000..6925ebb --- /dev/null +++ b/.github/workflows/continuous-build-openbsd.yml @@ -0,0 +1,57 @@ +name: Continuous Build OpenBSD + +on: + workflow_dispatch: + push: + branches: + - main + tags-ignore: + - '*.*' + paths: + - 'src/**' + - '!src/linux/**' + - '!src/osx/**' + - '!src/freebsd/**' + - 'include/**' + - 'Makefile' + - '.github/workflows/continuous-build-openbsd.yml' + pull_request: + branches: + - main + paths: + - 'src/**' + - '!src/linux/**' + - '!src/osx/**' + - '!src/freebsd/**' + - 'include/**' + - 'Makefile' + - '.github/workflows/continuous-build-openbsd.yml' + +jobs: + build-openbsd: + runs-on: ubuntu-22.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Compile + uses: vmactions/openbsd-vm@v1 + with: + release: '7.4' + usesh: true + prepare: | + pkg_add gmake gcc%11 g++%11 coreutils git lowdown + git config --global --add safe.directory /home/runner/work/btop/btop + run: | + gmake CXX=eg++ STATIC=true STRIP=true + GIT_HASH=$(git rev-parse --short "$GITHUB_SHA") + mv bin/btop bin/btop-GCC11-"$GIT_HASH" + ls -alh bin + + - uses: actions/upload-artifact@v3 + with: + name: btop-x86_64-openbsd-7.4 + path: 'bin/*' + if-no-files-found: error diff --git a/.github/workflows/test-snap-can-build.yml b/.github/workflows/test-snap-can-build.yml index bd63d14..6df8e47 100644 --- a/.github/workflows/test-snap-can-build.yml +++ b/.github/workflows/test-snap-can-build.yml @@ -1,18 +1,26 @@ name: 🧪 Test snap can be built on x86_64 on: + workflow_dispatch: push: - branches: [ main ] + branches: [ main ] tags-ignore: - '*.*' - paths: + paths: - 'src/**' - '!src/osx/**' - '!src/freebsd/**' - 'include/**' - 'Makefile' - - '.github/workflows/continuous-build-linux.yml' - pull_request: - branches: [ main ] + - '.github/workflows/test-snap-can-build.yml' + pull_request: + branches: [ main ] + paths: + - 'src/**' + - '!src/osx/**' + - '!src/freebsd/**' + - 'include/**' + - 'Makefile' + - '.github/workflows/test-snap-can-build.yml' jobs: build: @@ -46,9 +46,14 @@ stage/ *.out *.app +# Compiled man page +btop.1 + build bin btop +/obj/ +config.h .*/ # Optional libraries diff --git a/CHANGELOG.md b/CHANGELOG.md index bbf273b..d2c4bb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,30 @@ +## v1.3.2 + +Description | Author(s) | References +--- | --- | --- +fix: Can't detect librocm 6.0.x | @imwints, @aristocratos | #761 + +## v1.3.1 + +Description | Author(s) | References +--- | --- | --- +GPU: Added support for dynamic loading of ROCm v6 libraries | @aristocratos, @fxzjshm | 5511131, #737 +Increase max network interface name to 15 | @tessus | #714 +Fix OpenBSD UTF-8 locale detection | @lcheylus, @imwints | #753, #717 +Add hot-reloading of config file with CTRL+R or SIGUSR2 signal | @MartinPit | #722 +Add battery power draw for linux and freebsd | @vsey | #689 +Fix crash caused by string exception when cpu clock is exactly between 999.5 and 999.9 Mhz | @rkmcode | #735 +Write newline at end of config file | @planet36 | #743 +Add theme based on Everforest Dark Medium palette | @M-Sviridov | #746 +fix: don't mangle memory for zombie processes | @joske | #747 +Share common code from collect | @imwints | #756 +Fixed incorrect used and available memory for OSX | | 4461a43 + ## v1.3.0 -* Added Gpu Support | @romner-set | PR #529 +* Added Gpu Support Linux | @romner-set | PR #529 + +* Added platform support for OpenBSD | @joske | PR #607 * Enable macos clang | @muneebmahmed | PR #666 @@ -42,6 +66,16 @@ * Create adwaita.theme | @flipflop133 | #485 +* Try get terminal size of "/dev/tty" if stdout fails | @imwints | PR #627 + +* Refresh rate program argument | @imwints | PR #640 + +* Improved error handling when determining the config directory | @imwints | #652 + +* Use native POSIX polling syscalls to read input | @lvxnull | #624 + +* Conditional compile on Big Sur and up | @joske | PR #690 + + Various fixes by @imwints, @simplepad, @joske, @gwena, @cpalv, @iambeingtracked, @mattico, @NexAdn ## v1.2.13 @@ -146,7 +180,7 @@ * Fixed: Wrong memory unit when shorten and size is less than 10, by @mohi001 -* Fixed: Use cpu cores avarage temp if missing cpu package temp for FreeBSD +* Fixed: Use cpu cores average temp if missing cpu package temp for FreeBSD * Changed: Enter symbol to a more common variant @@ -442,7 +476,7 @@ * Fixed: Sizing constraints bug on start and boxes can be toggled from size error screen -* Fixed: UTF-8 check crashing if LANG was set to non existant locale +* Fixed: UTF-8 check crashing if LANG was set to non existent locale ## v1.0.4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f8c546..9a4dbec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") endif() project("btop" - VERSION 1.2.13 DESCRIPTION "A monitor of resources" HOMEPAGE_URL "https://github.com/aristocratos/btop" LANGUAGES CXX @@ -41,6 +40,7 @@ option(BTOP_LTO "Enable LTO" ON) option(BTOP_USE_MOLD "Use mold to link btop" OFF) option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF) option(BTOP_WERROR "Compile with warnings as errors" OFF) +option(BTOP_FORTIFY "Detect buffer overflows with _FORTIFY_SOURCE=3" ON) option(BTOP_GPU "Enable GPU support" ON) cmake_dependent_option(BTOP_RSMI_STATIC "Link statically to ROCm SMI" OFF "BTOP_GPU" OFF) @@ -64,6 +64,8 @@ if(APPLE) target_sources(btop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp) elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") target_sources(btop PRIVATE src/freebsd/btop_collect.cpp) +elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + target_sources(btop PRIVATE src/openbsd/btop_collect.cpp src/openbsd/sysctlbyname.cpp) elseif(LINUX) target_sources(btop PRIVATE src/linux/btop_collect.cpp) else() @@ -75,6 +77,21 @@ if(NOT CXX_HAVE_RANGES) message(FATAL_ERROR "The compiler doesn't support <ranges>") endif() +# Generate build info +execute_process( + COMMAND "git" "rev-parse" "--short" "HEAD" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) +set(CONFIGURE_COMMAND + "cmake -DBTOP_STATIC=${BTOP_STATIC} -DBTOP_USE_MOLD=${BTOP_USE_MOLD} -DBTOP_FORTIFY=${BTOP_FORTIFY} -DBTOP_GPU=${BTOP_GPU}" +) +get_filename_component(CXX_COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) +set(COMPILER "${CXX_COMPILER_BASENAME}") +set(COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY IMMEDIATE) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + # Check for and enable LTO check_ipo_supported(RESULT ipo_supported) if(ipo_supported AND BTOP_LTO) @@ -97,7 +114,7 @@ if(BTOP_WERROR) endif() if(NOT APPLE) - target_compile_options(btop PRIVATE -fstack-clash-protection) + target_compile_options(btop PRIVATE -fstack-clash-protection) endif() check_cxx_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR) if(HAS_FSTACK_PROTECTOR) @@ -109,10 +126,11 @@ if(HAS_FCF_PROTECTION) endif() target_compile_definitions(btop PRIVATE + FMT_HEADER_ONLY _FILE_OFFSET_BITS=64 $<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1> # Only has an effect with optimizations enabled - $<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2> + $<$<AND:$<NOT:$<CONFIG:Debug>>,$<BOOL:${BTOP_FORTIFY}>>:_FORTIFY_SOURCE=3> ) target_include_directories(btop SYSTEM PRIVATE include) @@ -129,7 +147,7 @@ if(LINUX AND BTOP_GPU) if(BTOP_RSMI_STATIC) # ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already # set - # We could also manully append ROCm's path here + # We could also manually append ROCm's path here set(_CMAKE_MODULE_PATH CMAKE_MODULE_PATH) unset(CMAKE_MODULE_PATH) @@ -178,12 +196,34 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") endif() find_package(devstat REQUIRED) - target_link_libraries(btop devstat::devstat) + find_package(kvm REQUIRED) + target_link_libraries(btop devstat::devstat kvm::kvm) if(BTOP_STATIC) find_package(elf REQUIRED) - find_package(kvm REQUIRED) - target_link_libraries(btop elf::elf kvm::kvm) + target_link_libraries(btop elf::elf) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(btop PRIVATE -static-libstdc++) endif() + find_package(kvm REQUIRED) + target_link_libraries(btop kvm::kvm) +endif() + + +# Check if lowdown is installed +find_program(LOWDOWN_EXECUTABLE lowdown) + +if(LOWDOWN_EXECUTABLE) + # Custom target to compile Markdown to man page using lowdown + add_custom_target(btop.1 ALL + COMMAND lowdown -s -Tman -o btop.1 manpage.md + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + # Install the man page + install(FILES btop.1 DESTINATION "share/man/man1") +else() + message(WARNING "Command 'lowdown' not found: skipping generating man page btop.1") endif() install(TARGETS btop RUNTIME) @@ -191,4 +231,3 @@ install(FILES "btop.desktop" DESTINATION "share/applications") install(FILES "Img/icon.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "btop.png") install(FILES "Img/icon.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME "btop.svg") install(DIRECTORY "themes" DESTINATION "share/btop") - @@ -50,6 +50,11 @@ ifeq ($(GPU_SUPPORT),true) override ADDFLAGS += -DGPU_SUPPORT endif +FORTIFY_SOURCE ?= true +ifeq ($(FORTIFY_SOURCE),true) + override ADDFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 +endif + #? Compiler and Linker ifeq ($(shell $(CXX) --version | grep clang >/dev/null 2>&1; echo $$?),0) override CXX_IS_CLANG := true @@ -61,6 +66,10 @@ CLANG_WORKS = false GCC_WORKS = false MIN_CLANG_VERSION = 16 +ifeq ($(DEBUG),true) + override ADDFLAGS += -DBTOP_DEBUG +endif + #? Supported is Clang 16.0.0 and later ifeq ($(CXX_IS_CLANG),true) ifeq ($(shell $(CXX) --version | grep Apple >/dev/null 2>&1; echo $$?),0) @@ -69,32 +78,9 @@ ifeq ($(CXX_IS_CLANG),true) ifneq ($(shell test $(CXX_VERSION_MAJOR) -lt $(MIN_CLANG_VERSION); echo $$?),0) CLANG_WORKS := true endif -endif -ifeq ($(CLANG_WORKS),false) - #? Try to find a newer GCC version - ifeq ($(shell command -v g++-13 >/dev/null; echo $$?),0) - CXX := g++-13 - else ifeq ($(shell command -v g++13 >/dev/null; echo $$?),0) - CXX := g++13 - else ifeq ($(shell command -v g++-12 >/dev/null; echo $$?),0) - CXX := g++-12 - else ifeq ($(shell command -v g++12 >/dev/null; echo $$?),0) - CXX := g++12 - else ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0) - CXX := g++-11 - else ifeq ($(shell command -v g++11 >/dev/null; echo $$?),0) - CXX := g++11 - else ifeq ($(shell command -v g++ >/dev/null; echo $$?),0) - CXX := g++ - else - GCC_NOT |