diff options
Diffstat (limited to 'src/shared/user-record-show.c')
-rw-r--r-- | src/shared/user-record-show.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/shared/user-record-show.c b/src/shared/user-record-show.c index a828ffa0a7..a9c635a478 100644 --- a/src/shared/user-record-show.c +++ b/src/shared/user-record-show.c @@ -7,6 +7,7 @@ #include "hashmap.h" #include "hexdecoct.h" #include "path-util.h" +#include "percent-util.h" #include "pretty-print.h" #include "process-util.h" #include "rlimit-util.h" @@ -54,6 +55,26 @@ static void show_self_modifiable( printf("%13s %s\n", i == value ? heading : "", *i); } +static void show_tmpfs_limit(const char *tmpfs, const TmpfsLimit *limit, uint32_t scale) { + assert(tmpfs); + assert(limit); + + if (!limit->is_set) + return; + + printf(" %s Limit:", tmpfs); + + if (limit->limit != UINT64_MAX) + printf(" %s", FORMAT_BYTES(limit->limit)); + if (limit->limit == UINT64_MAX || limit->limit_scale != UINT32_MAX) { + if (limit->limit != UINT64_MAX) + printf(" or"); + + printf(" %i%%", UINT32_SCALE_TO_PERCENT(scale)); + } + printf("\n"); +} + void user_record_show(UserRecord *hr, bool show_full_group_info) { _cleanup_strv_free_ char **langs = NULL; const char *hd, *ip, *shell; @@ -65,6 +86,13 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) { printf(" User name: %s\n", user_record_user_name_and_realm(hr)); + if (!strv_isempty(hr->aliases)) { + STRV_FOREACH(i, hr->aliases) + printf(i == hr->aliases ? + " Alias: %s" : ", %s", *i); + putchar('\n'); + } + if (hr->state) { const char *color; @@ -361,6 +389,9 @@ void user_record_show(UserRecord *hr, bool show_full_group_info) { if (hr->io_weight != UINT64_MAX) printf(" IO Weight: %" PRIu64 "\n", hr->io_weight); + show_tmpfs_limit("TMP", &hr->tmp_limit, user_record_tmp_limit_scale(hr)); + show_tmpfs_limit("SHM", &hr->dev_shm_limit, user_record_dev_shm_limit_scale(hr)); + if (hr->access_mode != MODE_INVALID) printf(" Access Mode: 0%03o\n", user_record_access_mode(hr)); |