Add read-only option

Add command line option to disable all system and process changing
features.
This commit is contained in:
Christian Göttsche
2021-01-21 20:27:37 +01:00
committed by cgzones
parent 812cfcb94d
commit 36880cd61c
12 changed files with 108 additions and 42 deletions

View File

@ -130,6 +130,9 @@ static enum CapMode Platform_capabilitiesMode = CAP_MODE_BASIC;
#endif
static Htop_Reaction Platform_actionSetIOPriority(State* st) {
if (Settings_isReadonly())
return HTOP_OK;
const LinuxProcess* p = (const LinuxProcess*) Panel_getSelected((Panel*)st->mainPanel);
if (!p)
return HTOP_OK;
@ -873,7 +876,7 @@ bool Platform_getLongOption(int opt, int argc, char** argv) {
switch (opt) {
#ifdef HAVE_LIBCAP
case 128: {
case 160: {
const char* mode = optarg;
if (!mode && optind < argc && argv[optind] != NULL &&
(argv[optind][0] != '\0' && argv[optind][0] != '-')) {