summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.editorconfig1
-rw-r--r--.github/workflows/ci.yml29
-rw-r--r--Action.c48
-rw-r--r--Action.h10
-rw-r--r--Affinity.c7
-rw-r--r--Affinity.h15
-rw-r--r--AffinityPanel.h4
-rw-r--r--AvailableColumnsPanel.h2
-rw-r--r--AvailableMetersPanel.c6
-rw-r--r--AvailableMetersPanel.h2
-rw-r--r--BatteryMeter.c2
-rw-r--r--CPUMeter.c141
-rw-r--r--CPUMeter.h8
-rw-r--r--CRT.c49
-rw-r--r--CRT.h33
-rw-r--r--CategoriesPanel.h4
-rw-r--r--CheckItem.c4
-rw-r--r--CheckItem.h8
-rw-r--r--ColorsPanel.c2
-rw-r--r--ColorsPanel.h2
-rw-r--r--ColumnsPanel.c4
-rw-r--r--ColumnsPanel.h6
-rw-r--r--DisplayOptionsPanel.c5
-rw-r--r--DisplayOptionsPanel.h2
-rw-r--r--EnvScreen.h8
-rw-r--r--FunctionBar.c2
-rw-r--r--FunctionBar.h14
-rw-r--r--Hashtable.c8
-rw-r--r--Hashtable.h12
-rw-r--r--Header.c12
-rw-r--r--Header.h26
-rw-r--r--IncSet.c44
-rw-r--r--IncSet.h20
-rw-r--r--InfoScreen.c10
-rw-r--r--InfoScreen.h12
-rw-r--r--ListItem.h8
-rw-r--r--MainPanel.c14
-rw-r--r--MainPanel.h22
-rw-r--r--Makefile.am4
-rw-r--r--MemoryMeter.c2
-rw-r--r--Meter.c19
-rw-r--r--Meter.h14
-rw-r--r--MetersPanel.c2
-rw-r--r--MetersPanel.h4
-rw-r--r--Object.c8
-rw-r--r--Object.h10
-rw-r--r--OpenFilesScreen.c1
-rw-r--r--OpenFilesScreen.h8
-rw-r--r--Panel.c4
-rw-r--r--Panel.h46
-rw-r--r--Process.c51
-rw-r--r--Process.h36
-rw-r--r--ProcessList.c10
-rw-r--r--ProcessList.h28
-rw-r--r--README54
-rw-r--r--RichString.c2
-rw-r--r--RichString.h18
-rw-r--r--ScreenManager.c24
-rw-r--r--ScreenManager.h12
-rw-r--r--Settings.c35
-rw-r--r--Settings.h14
-rw-r--r--SignalsPanel.h2
-rw-r--r--StringUtils.c7
-rw-r--r--StringUtils.h12
-rw-r--r--TasksMeter.c8
-rw-r--r--TraceScreen.c2
-rw-r--r--TraceScreen.h12
-rw-r--r--UsersTable.h6
-rw-r--r--Vector.c4
-rw-r--r--Vector.h26
-rw-r--r--XAlloc.h10
-rw-r--r--configure.ac9
-rw-r--r--darwin/DarwinProcess.c12
-rw-r--r--darwin/Platform.c4
-rw-r--r--dragonflybsd/DragonFlyBSDProcess.c4
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.c2
-rw-r--r--dragonflybsd/Platform.c3
-rw-r--r--freebsd/FreeBSDProcess.c4
-rw-r--r--freebsd/FreeBSDProcessList.c63
-rw-r--r--freebsd/Platform.c3
-rw-r--r--htop.1.in91
-rw-r--r--htop.c54
-rw-r--r--htop.desktop2
-rw-r--r--htop.h2
-rw-r--r--linux/Battery.c20
-rw-r--r--linux/Battery.h2
-rw-r--r--linux/IOPriority.c2
-rw-r--r--linux/IOPriority.h2
-rw-r--r--linux/IOPriorityPanel.h4
-rw-r--r--linux/LinuxCRT.h2
-rw-r--r--linux/LinuxProcess.c37
-rw-r--r--linux/LinuxProcess.h31
-rw-r--r--linux/LinuxProcessList.c204
-rw-r--r--linux/LinuxProcessList.h22
-rw-r--r--linux/Platform.c32
-rw-r--r--linux/Platform.h21
-rw-r--r--linux/PressureStallMeter.c133
-rw-r--r--linux/PressureStallMeter.h25
-rw-r--r--openbsd/Battery.c7
-rw-r--r--openbsd/Battery.h1
-rw-r--r--openbsd/OpenBSDProcess.c2
-rw-r--r--openbsd/OpenBSDProcessList.c142
-rw-r--r--openbsd/OpenBSDProcessList.h18
-rw-r--r--openbsd/Platform.c107
-rw-r--r--openbsd/Platform.h15
-rwxr-xr-xscripts/MakeHeader.py4
-rw-r--r--solaris/Platform.c17
-rw-r--r--solaris/Platform.h2
-rw-r--r--solaris/SolarisProcess.c2
-rw-r--r--solaris/SolarisProcessList.c30
-rw-r--r--solaris/SolarisProcessList.h4
-rw-r--r--unsupported/Platform.c7
-rw-r--r--unsupported/UnsupportedProcessList.c2
113 files changed, 1522 insertions, 729 deletions
diff --git a/.editorconfig b/.editorconfig
index 18807892..dd881dd0 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -14,3 +14,4 @@ charset = utf-8
[*.{c,h}]
indent_style = space
indent_size = 3
+trim_trailing_whitespace = true
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..74d0ece8
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,29 @@
+name: CI
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build-ubuntu-latest:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Build
+ run: |
+ sudo apt-get install libncursesw5-dev
+ ./autogen.sh
+ ./configure
+ make
+
+# build-macos-latest:
+# runs-on: macos-latest
+# steps:
+# - uses: actions/checkout@v2
+# - name: make
+# run: |
+# ./autogen.sh
+# ./configure
+# make
diff --git a/Action.c b/Action.c
index 9a7c3c56..825e743d 100644
--- a/Action.c
+++ b/Action.c
@@ -62,11 +62,11 @@ typedef struct State_ {
}*/
-Object* Action_pickFromVector(State* st, Panel* list, int x) {
+Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) {
Panel* panel = st->panel;
Header* header = st->header;
Settings* settings = st->settings;
-
+
int y = panel->y;
ScreenManager* scr = ScreenManager_new(0, header->height, 0, -1, HORIZONTAL, header, settings, false);
scr->allowFocusChange = false;
@@ -75,8 +75,8 @@ Object* Action_pickFromVector(State* st, Panel* list, int x) {
Panel* panelFocus;
int ch;
bool unfollow = false;
- int pid = MainPanel_selectedPid((MainPanel*)panel);
- if (header->pl->following == -1) {
+ int pid = followProcess ? MainPanel_selectedPid((MainPanel*)panel) : -1;
+ if (followProcess && header->pl->following == -1) {
header->pl->following = pid;
unfollow = true;
}
@@ -88,11 +88,16 @@ Object* Action_pickFromVector(State* st, Panel* list, int x) {
Panel_move(panel, 0, y);
Panel_resize(panel, COLS, LINES-y-1);
if (panelFocus == list && ch == 13) {
- Process* selected = (Process*)Panel_getSelected(panel);
- if (selected && selected->pid == pid)
+ if (followProcess) {
+ Process* selected = (Process*)Panel_getSelected(panel);
+ if (selected && selected->pid == pid)
+ return Panel_getSelected(list);
+ else
+ beep();
+ } else {
return Panel_getSelected(list);
- else
- beep();
+ }
+
}
return NULL;
}
@@ -189,7 +194,7 @@ static Htop_Reaction sortBy(State* st) {
Panel_setSelected(sortPanel, i);
free(name);
}
- ListItem* field = (ListItem*) Action_pickFromVector(st, sortPanel, 15);
+ ListItem* field = (ListItem*) Action_pickFromVector(st, sortPanel, 15, false);
if (field) {
reaction |= Action_setSortKey(st->settings, field->key);
}
@@ -248,10 +253,21 @@ static Htop_Reaction actionIncFilter(State* st) {
}
static Htop_Reaction actionIncSearch(State* st) {
+ IncSet_reset(((MainPanel*)st->panel)->inc, INC_SEARCH);
IncSet_activate(((MainPanel*)st->panel)->inc, INC_SEARCH, st->panel);
return HTOP_REFRESH | HTOP_KEEP_FOLLOWING;
}
+static Htop_Reaction actionIncNext(State* st) {
+ IncSet_next(((MainPanel*)st->panel)->inc, INC_SEARCH, st->panel, (IncMode_GetPanelValue) MainPanel_getValue);
+ return HTOP_REFRESH | HTOP_KEEP_FOLLOWING;
+}
+
+static Htop_Reaction actionIncPrev(State* st) {
+ IncSet_prev(((MainPanel*)st->panel)->inc, INC_SEARCH, st->panel, (IncMode_GetPanelValue) MainPanel_getValue);
+ return HTOP_REFRESH | HTOP_KEEP_FOLLOWING;
+}
+
static Htop_Reaction actionHigherPriority(State* st) {
bool changed = changePriority((MainPanel*)st->panel, -1);
return changed ? HTOP_REFRESH : HTOP_OK;
@@ -297,7 +313,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
return HTOP_OK;
#if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY)
Panel* panel = st->panel;
-
+
Process* p = (Process*) Panel_getSelected(panel);
if (!p) return HTOP_OK;
Affinity* affinity = Affinity_get(p, st->pl);
@@ -305,7 +321,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
Panel* affinityPanel = AffinityPanel_new(st->pl, affinity);
Affinity_delete(affinity);
- void* set = Action_pickFromVector(st, affinityPanel, 15);
+ void* set = Action_pickFromVector(st, affinityPanel, 15, true);
if (set) {
Affinity* affinity = AffinityPanel_getAffinity(affinityPanel, st->pl);
bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (Arg){ .v = affinity }, NULL);
@@ -319,7 +335,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
static Htop_Reaction actionKill(State* st) {
Panel* signalsPanel = (Panel*) SignalsPanel_new();
- ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 15);
+ ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 15, true);
if (sgn) {
if (sgn->key != 0) {
Panel_setHeader(st->panel, "Sending...");
@@ -340,7 +356,7 @@ static Htop_Reaction actionFilterByUser(State* st) {
Vector_insertionSort(usersPanel->items);
ListItem* allUsers = ListItem_new("All users", -1);
Panel_insert(usersPanel, 0, (Object*) allUsers);
- ListItem* picked = (ListItem*) Action_pickFromVector(st, usersPanel, 20);
+ ListItem* picked = (ListItem*) Action_pickFromVector(st, usersPanel, 20, false);
if (picked) {
if (picked == allUsers) {
st->pl->userId = -1;
@@ -463,7 +479,7 @@ static Htop_Reaction actionHelp(State* st) {
if (settings->detailedCPUTime) {
addattrstr(CRT_colors[CPU_NICE_TEXT], "low"); addstr("/");
addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/");
- addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/");
+ addattrstr(CRT_colors[CPU_SYSTE