From 0ada9f325f69ddb0f917f023fa701ce7669cd370 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 17 Mar 2021 14:29:40 +1100 Subject: Move libcap use to (Linux) platform-specific code The libcap code is Linux-specific so move it all below the linux/ platform subdirectory. As this feature has custom command-line long options I provide a mechanism whereby each platform can add custom long options that augment the main htop options. We'll make use this of this with the pcp/ platform in due course to implement the --host and --archive options there. Related to https://github.com/htop-dev/htop/pull/536 --- linux/Platform.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'linux/Platform.h') diff --git a/linux/Platform.h b/linux/Platform.h index fbf8be36..30544997 100644 --- a/linux/Platform.h +++ b/linux/Platform.h @@ -27,6 +27,19 @@ in the source distribution for its full text. #define PATH_MAX 4096 #endif +#ifdef HAVE_LIBCAP + #define PLATFORM_LONG_OPTIONS \ + {"drop-capabilities", optional_argument, 0, 128}, + #define PLATFORM_LONG_OPTIONS_USAGE \ + " --drop-capabilities[=none|basic|strict] Drop Linux capabilities when running as root\n" \ + " none - do not drop any capabilities\n" \ + " basic (default) - drop all capabilities not needed by htop\n" \ + " strict - drop all capabilities except those needed for core functionality\n" +#else + #define PLATFORM_LONG_OPTIONS + #define PLATFORM_LONG_OPTIONS_USAGE +#endif + extern const ProcessField Platform_defaultFields[]; @@ -82,4 +95,6 @@ static inline void Platform_getRelease(char** string) { *string = Generic_uname(); } +bool Platform_getLongOption(int opt, int argc, char** argv); + #endif -- cgit v1.2.3