diff options
author | Fynn Wulf <fynn_wulf@gmx.de> | 2020-10-09 21:02:27 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2020-11-09 19:17:57 +0100 |
commit | 84dad4c38ee4eb16ea8716891419b0a3780f3818 (patch) | |
tree | 5de1c6dfae20d5d43ad7b65a4b44a4e4cbff8ece /Action.c | |
parent | 0806a7958b5b5ee29da043d3e4f3f854c164059d (diff) |
Implement screen for active file locks
Diffstat (limited to 'Action.c')
-rw-r--r-- | Action.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -34,6 +34,10 @@ in the source distribution for its full text. #include "Vector.h" #include "XUtils.h" +#ifdef HTOP_LINUX +#include "linux/ProcessLocksScreen.h" +#endif + Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) { Panel* panel = st->panel; @@ -371,6 +375,19 @@ static Htop_Reaction actionLsof(State* st) { return HTOP_REFRESH | HTOP_REDRAW_BAR; } +#ifdef HTOP_LINUX +static Htop_Reaction actionShowLocks(State* st) { + Process* p = (Process*) Panel_getSelected(st->panel); + if (!p) return HTOP_OK; + ProcessLocksScreen* pls = ProcessLocksScreen_new(p); + InfoScreen_run((InfoScreen*)pls); + ProcessLocksScreen_delete((Object*)pls); + clear(); + CRT_enableDelay(); + return HTOP_REFRESH | HTOP_REDRAW_BAR; +} +#endif + static Htop_Reaction actionStrace(State* st) { Process* p = (Process*) Panel_getSelected(st->panel); if (!p) return HTOP_OK; @@ -435,6 +452,9 @@ static const struct { const char* key; const char* info; } helpRight[] = { { .key = " e: ", .info = "show process environment" }, { .key = " i: ", .info = "set IO priority" }, { .key = " l: ", .info = "list open files with lsof" }, +#ifdef HTOP_LINUX + { .key = " x: ", .info = "list file locks of process" }, +#endif { .key = " s: ", .info = "trace syscalls with strace" }, { .key = " w: ", .info = "wrap process command in multiple lines" }, { .key = " F2 C S: ", .info = "setup" }, @@ -620,6 +640,9 @@ void Action_setBindings(Htop_Action* keys) { keys['S'] = actionSetup; keys['C'] = actionSetup; keys[KEY_F(2)] = actionSetup; +#ifdef HTOP_LINUX + keys['x'] = actionShowLocks; +#endif keys['l'] = actionLsof; keys['s'] = actionStrace; keys[' '] = actionTag; |