mirror of
https://github.com/systemd/systemd.git
synced 2025-06-02 17:07:47 +03:00
Merge pull request #25532 from Werkov/fix-cgtop-args
cgtop: Do not rewrite -P or -k options
This commit is contained in:
commit
8936a2a8f0
@ -56,6 +56,12 @@ typedef struct Group {
|
||||
uint64_t io_input_bps, io_output_bps;
|
||||
} Group;
|
||||
|
||||
typedef enum PidsCount {
|
||||
COUNT_USERSPACE_PROCESSES,
|
||||
COUNT_ALL_PROCESSES,
|
||||
COUNT_PIDS,
|
||||
} PidsCount;
|
||||
|
||||
static unsigned arg_depth = 3;
|
||||
static unsigned arg_iterations = UINT_MAX;
|
||||
static bool arg_batch = false;
|
||||
@ -66,11 +72,7 @@ static char* arg_root = NULL;
|
||||
static bool arg_recursive = true;
|
||||
static bool arg_recursive_unset = false;
|
||||
|
||||
static enum {
|
||||
COUNT_PIDS,
|
||||
COUNT_USERSPACE_PROCESSES,
|
||||
COUNT_ALL_PROCESSES,
|
||||
} arg_count = COUNT_PIDS;
|
||||
static PidsCount arg_count = COUNT_PIDS;
|
||||
|
||||
static enum {
|
||||
ORDER_PATH,
|
||||
@ -916,6 +918,7 @@ static int run(int argc, char *argv[]) {
|
||||
usec_t last_refresh = 0;
|
||||
bool quit = false, immediate_refresh = false;
|
||||
_cleanup_free_ char *root = NULL;
|
||||
PidsCount possible_count;
|
||||
CGroupMask mask;
|
||||
int r;
|
||||
|
||||
@ -929,7 +932,8 @@ static int run(int argc, char *argv[]) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine supported controllers: %m");
|
||||
|
||||
arg_count = (mask & CGROUP_MASK_PIDS) ? COUNT_PIDS : COUNT_USERSPACE_PROCESSES;
|
||||
possible_count = (mask & CGROUP_MASK_PIDS) ? COUNT_PIDS : COUNT_ALL_PROCESSES;
|
||||
arg_count = MIN(possible_count, arg_count);
|
||||
|
||||
if (arg_recursive_unset && arg_count == COUNT_PIDS)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
|
@ -15,8 +15,8 @@ systemd-cgtop --cpu=percentage
|
||||
systemd-cgtop --cpu=time
|
||||
systemd-cgtop -P
|
||||
systemd-cgtop -k
|
||||
# FIXME: https://github.com/systemd/systemd/issues/25248
|
||||
#systemd-cgtop --recursive=no
|
||||
systemd-cgtop --recursive=no -P
|
||||
systemd-cgtop --recursive=no -k
|
||||
systemd-cgtop --depth=0
|
||||
systemd-cgtop --depth=100
|
||||
|
||||
@ -29,4 +29,5 @@ systemd-cgtop -p -t -c -m -i
|
||||
(! systemd-cgtop --order=foo)
|
||||
(! systemd-cgtop --depth=-1)
|
||||
(! systemd-cgtop --recursive=foo)
|
||||
(! systemd-cgtop --recursive=no)
|
||||
(! systemd-cgtop --delay=1foo)
|
||||
|
Loading…
x
Reference in New Issue
Block a user