Skip to content

Commit 22061fa

Browse files
committed
v1.2.0 FreeBSD Support
1 parent 1816f9d commit 22061fa

File tree

4 files changed

+110
-7
lines changed

4 files changed

+110
-7
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## v1.2.0
2+
3+
* Added: Support for FreeBSD, by @joske and @aristocratos
4+
5+
* Fixed (again): Account for system rolling over net speeds in Net::collect()
6+
7+
* Added: Theme gruvbox_material_dark, by @marcoradocchia
8+
9+
* Added: Option for base 10 bytes/bits
10+
11+
## v1.1.5
12+
13+
* Fixed: Account for system rolling over net speeds in Net::collect()
14+
115
## v1.1.4
216

317
* Fixed: Create dependency files in build directory when compiling, by @stwnt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ ifeq ($(PLATFORM_LC),linux)
8585
else ifeq ($(PLATFORM_LC),freebsd)
8686
PLATFORM_DIR := freebsd
8787
THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
88-
SU_GROUP := root
88+
SU_GROUP := wheel
8989
override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc11
9090
export MAKE = gmake
9191
else ifeq ($(PLATFORM_LC),macos)

README.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@
3131
* [Installation Linux/OSX](#installation)
3232
* [Compilation Linux](#compilation-linux)
3333
* [Compilation OSX](#compilation-osx)
34+
* [Compilation FreeBSD](#compilation-freebsd)
3435
* [Installing the snap](#installing-the-snap)
3536
* [Configurability](#configurability)
3637
* [License](#license)
3738

3839
## News
3940

40-
### Under development
41+
##### 16 January 2022
42+
43+
Release v1.2.0 with FreeBSD support. No release binaries for FreeBSD provided as of yet.
44+
45+
Again a big thanks to [@joske](https://github.com/joske) for his porting efforts!
46+
47+
Since compatibility with Linux, MacOS and FreeBSD are done, the focus going forward will be on new features like GPU monitoring.
4148

4249
##### 13 November 2021
4350

@@ -460,6 +467,89 @@ Also needs a UTF8 locale and a font that covers:
460467
gmake help
461468
```
462469

470+
## Compilation FreeBSD
471+
472+
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
473+
474+
Note that GNU make (`gmake`) is required to compile on FreeBSD.
475+
476+
1. **Install dependencies**
477+
478+
``` bash
479+
sudo pkg install gmake gcc11 coreutils git
480+
```
481+
482+
2. **Clone repository**
483+
484+
``` bash
485+
git clone https://github.com/aristocratos/btop.git
486+
cd btop
487+
```
488+
489+
3. **Compile**
490+
491+
Append `STATIC=true` to `make` command for static compilation.
492+
493+
Append `QUIET=true` for less verbose output.
494+
495+
Append `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag).
496+
497+
Append `ARCH=<architecture>` to manually set the target architecture.
498+
If omitted the makefile uses the machine triple (output of `-dumpmachine` compiler parameter) to detect the target system.
499+
500+
Use `ADDFLAGS` variable for appending flags to both compiler and linker.
501+
502+
For example: `ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system.
503+
504+
``` bash
505+
gmake
506+
```
507+
508+
4. **Install**
509+
510+
Append `PREFIX=/target/dir` to set target, default: `/usr/local`
511+
512+
Notice! Only use "sudo" when installing to a NON user owned directory.
513+
514+
``` bash
515+
sudo gmake install
516+
```
517+
518+
5. **(Recommended) Set suid bit to make btop always run as root (or other user)**
519+
520+
No need for `sudo` to see information for non user owned processes and to enable signal sending to any process.
521+
522+
Run after make install and use same PREFIX if any was used at install.
523+
524+
Set `SU_USER` and `SU_GROUP` to select user and group, default is `root` and `wheel`
525+
526+
``` bash
527+
sudo gmake setuid
528+
```
529+
530+
* **Uninstall**
531+
532+
``` bash
533+
sudo gmake uninstall
534+
```
535+
536+
* **Remove any object files from source dir**
537+
538+
```bash
539+
gmake clean
540+
```
541+
542+
* **Remove all object files, binaries and created directories in source dir**
543+
544+
```bash
545+
gmake distclean
546+
```
547+
548+
* **Show help**
549+
550+
```bash
551+
gmake help
552+
```
463553

464554
## Installing the snap
465555
[![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop)

src/btop.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tab-size = 4
2020
#include <clocale>
2121
#include <pthread.h>
2222
#ifdef __FreeBSD__
23-
#include <pthread_np.h>
23+
#include <pthread_np.h>
2424
#endif
2525
#include <thread>
2626
#include <numeric>
@@ -60,7 +60,7 @@ namespace Global {
6060
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
6161
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
6262
};
63-
const string Version = "1.1.4";
63+
const string Version = "1.2.0";
6464

6565
int coreCount;
6666
string overlay;
@@ -209,14 +209,14 @@ void clean_quit(int sig) {
209209
if (Global::_runner_started) {
210210
#ifdef __APPLE__
211211
if (pthread_join(Runner::runner_id, NULL) != 0) {
212-
Logger::error("Failed to join _runner thread!");
212+
Logger::warning("Failed to join _runner thread on exit!");
213213
pthread_cancel(Runner::runner_id);
214214
}
215215
#else
216216
struct timespec ts;
217217
ts.tv_sec = 5;
218218
if (pthread_timedjoin_np(Runner::runner_id, NULL, &ts) != 0) {
219-
Logger::error("Failed to join _runner thread!");
219+
Logger::warning("Failed to join _runner thread on exit!");
220220
pthread_cancel(Runner::runner_id);
221221
}
222222
#endif
@@ -243,7 +243,6 @@ void clean_quit(int sig) {
243243

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

246-
//? Assume error if still not cleaned up and call quick_exit to avoid a segfault from Tools::atomic_lock destructor
247246
#ifdef __APPLE__
248247
_Exit(excode);
249248
#else

0 commit comments

Comments
 (0)