summaryrefslogtreecommitdiffstats
path: root/src/cgtop (follow)
Commit message (Collapse)AuthorAgeFilesLines
* process-util: add pidref_is_kernel_thread()Lennart Poettering2023-10-181-1/+1
|
* tree-wide: port various parsers over to read_stripped_line()Lennart Poettering2023-10-171-4/+3
|
* treewide: fix typosJoerg Behrmann2023-09-191-1/+1
| | | | | | - mostly: usecase -> use case - continously -> continuously - single typos in docs/FILE_DESCRIPTOR_STORE.md
* meson: move declarations of cgls, cgtop, initctl, and systemd-mountYu Watanabe2023-08-011-0/+9
|
* time-util: introduce usleep_safe()Yu Watanabe2023-06-221-1/+1
| | | | | | | | We use usec_t for storing time value, which is 64bit. However, usleep() takes useconds_t that is (typically?) 32bit. Also, usleep() may only support the range [0, 1000000]. This introduce usleep_safe() which takes usec_t.
* cgls/cgtop: spell field/column "CGroup" rather than "Control Group"Lennart Poettering2023-06-051-1/+1
| | | | | | | | | | | | | | In the documentation we usually spell the concept "control group". Internally in code we usually call it "cgroup" or "CGroup". In systemctl output we called the field "CGroup" so far, i.e. a capitalized version of the internal name. This is of course very unsystematic. Let's clean this up a bit: let's now say: * in docs, continue to spell it out "control groups" * in brief output call it "CGroup" * internally call it "cgroup" or "CGroup" Fixes: #14429
* cgtop: drop counterproductive bitfieldsZbigniew Jędrzejewski-Szmek2023-03-141-4/+4
| | | | | The variable after the bitfields has 8 byte alignment, so we weren't saving any memory, but the code to serve the bitfields was more complicated.
* cgtop: split out the main loop into a separate functionZbigniew Jędrzejewski-Szmek2023-03-141-40/+41
| | | | This way the initial setup is nicely separated from the main loop logic.
* cgtop: Update code commentsMichal Koutný2022-11-301-2/+4
|
* cgtop: Do not rewrite -P or -k optionsMichal Koutný2022-11-281-6/+10
| | | | | | | | | | --recursive=no will overwrite possible -P or -k option hence making the recursive disabling impossible. Check what counting types the system supports (encoded in the ordering of our enum) of and pick whatever user requests but is also supported. Fixes: #25248
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* tree-wide: Fix field width specifier warningsJan Janssen2022-08-301-2/+4
| | | | | The casting here isn't pretty, but at least it makes it obvious what is happening instead of implicit and it allows enabling -Wformat-signedness.
* tree-wide: Fix format specifier warnings for %xJan Janssen2022-08-301-1/+1
| | | | | | Unfortunately, hex output can only be produced with unsigned types. Some cases can be fixed by producing the correct type, but a few simply have to be cast. At least casting makes it explicit.
* strv: declare iterator of FOREACH_STRING() in the loopZbigniew Jędrzejewski-Szmek2022-03-231-1/+0
| | | | | | | | | | | Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354. No functional change intended. The type of the iterator is generally changed to be 'const char*' instead of 'char*'. Despite the type commonly used, modifying the string was not allowed. I adjusted the naming of some short variables for clarity and reduced the scope of some variable declarations in code that was being touched anyway.
* tree-wide: voidify unchecked snprintf callsLuca Boccassi2021-08-201-2/+2
| | | | | | | | | | | | | | | According to Coverity, 194 ouf of 227 times we check for snprintf return code. Voidify the rest. CID#1461512 CID#1461513 CID#1461514 CID#1461515 CID#1461516 CID#1461518 CID#1461519 CID#1461520 CID#1461522
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* cgtop: use anonymous buffers for formatting of bytes and timespansZbigniew Jędrzejewski-Szmek2021-07-091-25/+27
|
* tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-3/+2
|
* tree-wide: always drop unnecessary dot in pathYu Watanabe2021-05-281-1/+1
|
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-041-2/+2
|
* tree-wide: use usec_add() and usec_sub_unsigned()Yu Watanabe2021-03-041-10/+5
|
* tree-wide: add a helper to parse boolean optargZbigniew Jędrzejewski-Szmek2021-02-171-4/+4
| | | | | | | | | This nicely covers the case when optarg is optional. The same parser can be used when the option string passed to getopt_long() requires a parameter and when it doesn't. The error messages are made consistent. Also fixes a log error c&p in --crash-reboot message.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-5/+4
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* cgtop: use ansi_normal() or friends instead of ANSI_NORMALYu Watanabe2021-01-251-7/+5
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* cgtop: Display cpu time in microseonds with --rawArian van Putten2020-10-211-3/+12
| | | | | | | this makes the CPU time easily parseable; which was the goal of --raw in the first place. This only triggers if --raw is combined with --cpu=time
* util: make size macros unsignedLennart Poettering2020-10-201-1/+1
| | | | | | | | | By making them unsigned comparing them with other sizes is less likely to trigger compiler warnings regarding signed/unsigned comparisons. After all sizes (i.e. size_t) are generally assumed to be unsigned, so these should be too. Prompted-by: https://github.com/systemd/systemd/pull/17345#issuecomment-709402332
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-2/+1
|
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-3/+1
| | | | | | | | | | | | | | | | Presently, CLI utilities such as systemctl will check whether they have a tty attached or not to decide whether to parse /proc/cmdline or EFI variable SystemdOptions looking for systemd.log_* entries. But this check will be misleading if these tools are being launched by a daemon, such as a monitoring daemon or automation service that runs in background. Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI variables to determine the logging level. Furthermore, introduce a new log_setup_cli() shortcut to set up common options used by most command-line utilities.
* Remove path_compare_func() alias for path_compare()Zbigniew Jędrzejewski-Szmek2019-11-151-1/+1
| | | | Non sunt multiplicanda entia sine necessitate.
* tree-wide: drop alloca.h when alloc-util.h is includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop missing.hYu Watanabe2019-10-311-0/+1
|
* tree-wide: replace strjoin() with path_join()Yu Watanabe2019-06-201-1/+1
|
* cgtop,test: use consistent capitalization for CGroupZbigniew Jędrzejewski-Szmek2019-05-211-1/+1
|
* Merge pull request #12411 from keszybz/pr/12394Lennart Poettering2019-05-081-0/+1
|\ | | | | run: when emitting the calendarspec warning, use red
| * Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* | codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|/
* tree-wide: use SYNTHETIC_ERRNO() where appropriateLennart Poettering2019-04-021-4/+3
|
* util: split out sorting related calls to new sort-util.[ch]Lennart Poettering2019-03-131-1/+1
|
* cgtop: Fix processing of controllers other than CPUSzabolcs Fruhwald2019-02-211-65/+65
| | | | | | | | | | | | | | After debugging the issue with gdb, I found that the following change 94ddb08 "cgtop: Still try to get CPU statistics if controller-free" has introduced a bug, which prevents process(..) method processing memory and io controllers when cpu_accounting_is_cheap() is true. The obvious fix is to move this branch to be the last one, keeping the intended behavior of the above change, without having a negative effect on the other controllers. Fixes #11773 [systemd-cgtop no longer shows memory (and io) usage]
* procfs-util: expose functionality to query total memoryZbigniew Jędrzejewski-Szmek2019-01-221-1/+1
| | | | | | | | procfs_memory_get_current is renamed to procfs_memory_get_used, because "current" can mean anything, including total memory, used memory, and free memory, as long as the value is up to date. No functional change.
* cgroup: s/cgroups? ?v?([0-9])/cgroup v\1/gIChris Down2019-01-031-1/+1
| | | | | | | | | | Nitpicky, but we've used a lot of random spacings and names in the past, but we're trying to be completely consistent on "cgroup vN" now. Generated by `fd -0 | xargs -0 -n1 sed -ri --follow-symlinks 's/cgroups? ?v?([0-9])/cgroup v\1/gI'`. I manually ignored places where it's not appropriate to replace (eg. "cgroup2" fstype and in src/shared/linux).
* cgtop: use SWAP_TWO() macroYu Watanabe2018-12-021-5/+1
|
* cgtop: introduce group_hash_ops and use itYu Watanabe2018-12-021-18/+10
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-16/+15
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-0/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* util-lib: move main() definition macros to its own header fileLennart Poettering2018-11-191-0/+1
| | | | | | | | | This way, we can extend the macro a bit with stuff pulled in from other headers without this affecting everything which pulls in macro.h, which is one of our most basic headers. This is just refactoring, no change in behaviour, in prepartion for later changes.
* Merge pull request #10811 from keszybz/define-main-through-macroLennart Poettering2018-11-191-29/+16
|\ | | | | Define main through macro