Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(libbtop Threads::Threads)

# Enable io_uring for optimized process collection (Linux only)
if(LINUX)
target_link_libraries(libbtop uring)
endif()

# Enable GPU support
if(LINUX AND BTOP_GPU)
target_compile_definitions(libbtop PUBLIC GPU_SUPPORT)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ WARNFLAGS := -Wall -Wextra -pedantic
OPTFLAGS := -O2 $(LTO)
LDCXXFLAGS := -pthread -DFMT_HEADER_ONLY -D_GLIBCXX_ASSERTIONS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS) -luring
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR) -I$(BUILDDIR)
SU_USER := root

Expand Down
1 change: 1 addition & 0 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void clean_quit(int sig) {
#endif
#endif

Proc::cleanup();

if (Config::getB("save_config_on_exit")) {
Config::write();
Expand Down
4 changes: 4 additions & 0 deletions src/btop_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace Shared {
void init();

extern long coreCount, page_size, clk_tck;
extern int proc_fd; //* File descriptor for /proc directory

#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
struct KvmDeleter {
Expand Down Expand Up @@ -434,6 +435,9 @@ namespace Proc {
//* Collect and sort process information from /proc
auto collect(bool no_update = false) -> vector<proc_info>&;

//* Cleanup resources on exit (io_uring, file descriptors)
void cleanup();

//* Update current selection and view, returns -1 if no change otherwise the current selection
int selection(const std::string_view cmd_key);

Expand Down
4 changes: 4 additions & 0 deletions src/freebsd/btop_collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,10 @@ namespace Proc {
numpids = (int)current_procs.size() - filter_found;
return current_procs;
}

void cleanup() {
// No resources to cleanup on FreeBSD
}
} // namespace Proc

namespace Tools {
Expand Down
Loading
Loading