summaryrefslogtreecommitdiff
path: root/src/systemctl
Commit message (Collapse)AuthorAgeFilesLines
...
* basic: add RuntimeScope enumLennart Poettering2023-03-1014-51/+47
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* systemctl: port FOREACH_ARRAY() to systemctl-list-units.cYu Watanabe2023-03-071-13/+13
|
* systemctl: explicitly cast the constants to uint64_tFrantisek Sumsal2023-03-031-1/+1
| | | | | | | | | | | | | | | | | | | Otherwise under certain conditions `va_arg()` might get garbage instead of the expected value, i.e.: $ sudo build-o0/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 0 Failed to disable unit: Unit file asdfasfaf.service does not exist. $ sudo build-o1/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 7954875719681572864 Failed to disable unit: Invalid argument (reproduced on an armv7hl machine) Resolves: #26568 Follow-up to: bf1bea43f15 Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735
* systemctl: print better message if default target is maskedDavid Tardon2023-02-281-0/+2
| | | | | | | | | | | If the default target is masked, `systemctl get-default` prints Failed to get default target: Operation not possible due to RF-kill That's a bit too cryptic, so let's make it clear what's actually happening. Fixes #26589.
* systemctl: use bus_message_hash_opsYu Watanabe2023-02-231-18/+8
|
* Merge pull request #26535 from yuwata/systemctl-list-cleanupsYu Watanabe2023-02-232-279/+307
|\ | | | | systemctl-list: several cleanups
| * systemctl: cleanups for list-pathsYu Watanabe2023-02-231-67/+62
| | | | | | | | | | | | | | | | - Rename struct path_info -> PathInfo, - Drop struct path_infos, - Use CLEANUP_ARRAY(), No functional change, just refactoring.
| * systemctl: cleanups for list-automountsYu Watanabe2023-02-231-37/+47
| | | | | | | | | | | | | | - Rename struct automount_info -> AutomountInfo, - use CLEANUP_ARRAY(), and etc. No functional change, just refactoring.
| * systemctl: cleanups for list-timersYu Watanabe2023-02-232-52/+81
| | | | | | | | | | | | | | - Rename struct timer_info -> TimerInfo, - use CLEANUP_ARRAY(). No functional change, just refactoring.
| * systemctl: cleanups for list-socketsYu Watanabe2023-02-231-100/+104
| | | | | | | | | | | | | | | | - Rename struct socket_info -> SocketInfo. - Drop own_triggered field, and always copy the triggered field. - Use CLEANUP_ARRAY(). No functional changes, just refactoring.
| * systemctl-list-units: drop unused return valueYu Watanabe2023-02-231-18/+10
| |
| * systemctl-list-units: fix memleak on errorYu Watanabe2023-02-231-7/+5
| |
* | Merge pull request #26556 from keszybz/list-timers-optimize-leftZbigniew Jędrzejewski-Szmek2023-02-231-1/+1
|\ \ | |/ |/| Do not say " left" on every timer in LEFT column
| * systemctl: make list-timers not say "left" in "LEFT" columnZbigniew Jędrzejewski-Szmek2023-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We would print: NEXT LEFT LAST PASSED UNIT > Wed 2023-02-22 23:55:00 CET 20min left Wed 2023-02-22 23:25:00 CET 9min ago pmlogger_check.timer > Wed 2023-02-22 23:55:10 CET 21min left Wed 2023-02-22 23:25:16 CET 8min ago pmlogger_farm_check.timer > Wed 2023-02-22 23:58:00 CET 23min left Wed 2023-02-22 23:28:02 CET 6min ago pmie_check.timer > Wed 2023-02-22 23:58:10 CET 24min left Wed 2023-02-22 23:28:11 CET 5min ago pmie_farm_check.timer > Thu 2023-02-23 00:00:00 CET 25min left Wed 2023-02-22 00:00:10 CET 23h ago logrotate.timer > Thu 2023-02-23 00:00:00 CET 25min left Wed 2023-02-22 00:00:10 CET 23h ago unbound-anchor.timer > Thu 2023-02-23 00:08:00 CET 33min left Wed 2023-02-22 00:08:05 CET 23h ago pmie_daily.timer > Thu 2023-02-23 00:10:00 CET 35min left Wed 2023-02-22 00:10:03 CET 23h ago pmlogger_daily.timer > Thu 2023-02-23 00:14:14 CET 40min left Wed 2023-02-22 22:35:09 CET 58min ago dnf-makecache.timer > Thu 2023-02-23 05:05:04 CET 5h 30min left Wed 2023-02-22 03:29:00 CET 20h ago plocate-updatedb.timer > Thu 2023-02-23 11:34:34 CET 12h left Wed 2023-02-22 11:34:33 CET 11h ago systemd-tmpfiles-clean.timer > Sun 2023-02-26 01:00:00 CET 3 days left Mon 2023-02-20 07:51:59 CET 2 days ago raid-check.timer > Mon 2023-02-27 00:19:48 CET 4 days left Mon 2023-02-20 07:51:59 CET 2 days ago fstrim.timer > Mon 2023-02-27 12:34:36 CET 4 days left Tue 2023-02-21 08:22:14 CET 1 day 15h ago archlinux-keyring-wkd-sync.time> The "left" part uses precious screen estate and is pretty much implied by the column name. Drop it.
* | systemctl: read 64bit integers into uint64_tLennart Poettering2023-02-221-1/+1
| | | | | | | | | | | | usec_t is also a uint64_t internally, hence this doesn't actually change anything. However, on the conceptual level, sd-bus expects a uint64_t hence give it one.
* | systemctl: suppress timeout display if unset in list-automountsLennart Poettering2023-02-221-3/+12
| | | | | | | | If the timeout is zero it's not set, let's suppress the output then.
* | systemctl: right-align left/passed columns in list-timersLennart Poettering2023-02-221-0/+3
| | | | | | | | | | | | Timespans are probably best right-aligned, in particular if they systematically end in either " ago" or " left" because they are used as "relative timestamps".
* | systemctl: warn if units disabled in user scope are still enabled globallyMike Yuan2023-02-221-0/+37
| | | | | | | | Fixes #18271
* | systemctl: show "Until:" field only for service and scope unitsYu Watanabe2023-02-221-0/+1
|/ | | | | | | | Only service and scope units have RuntimeMaxUSec bus property. To suppress the "Until:" field for other unit types, the entry must be initialized with USEC_INFINITY. Fixes #26473.
* Merge pull request #26203 from medhefgo/mesonYu Watanabe2023-02-221-4/+8
|\ | | | | meson: Use dicts for test/fuzzer definitions
| * meson: Use dicts for fuzzer definitionsJan Janssen2023-02-211-4/+8
| |
* | Merge pull request #26491 from dtardon/list-pathsYu Watanabe2023-02-223-54/+261
|\ \ | |/ |/| Add systemctl list-paths
| * systemctl: add list-paths verbDavid Tardon2023-02-213-0/+217
| | | | | | | | Fixes #6054.
| * systemctl: prepend machine ID to unit ID in list-socketsDavid Tardon2023-02-211-11/+6
| | | | | | | | We do it that way in all other list-* functions, so let's be consistent.
| * systemctl: extract common code to a functionDavid Tardon2023-02-211-29/+19
| |
| * systemctl: use table_add_triggeredDavid Tardon2023-02-211-7/+6
| |
| * systemctl: extract code to a helper functionDavid Tardon2023-02-211-9/+15
| | | | | | | | It will be used more in subsequent commits.
* | systemctl: edit: fix double free of instanced nameRonan Pigott2023-02-191-3/+3
| | | | | | | | | | There is a double free of unit_name when an instance is used, causing systemctl --user edit service@instance to abort.
* | dissect-image: Return mount point fd if requestedDaan De Meyer2023-02-171-0/+1
| |
* | systemctl: add --kill-value= argument to systemctlLennart Poettering2023-02-173-11/+50
|/ | | | | | | | | | | This allows accompanying a signal with a value (as supported for Linux Realtime signals). This is particularly useful as it allows us to do stuff like this: systemctl kill --kill-whom=main --kill-value=0x300 systemd-journald In order to ask journald to flush its allocation caches and compact memory.
* core: add support for Startup memory limitsLuca Boccassi2023-02-151-4/+38
| | | | | We support separate Startup configurations for CPU and I/O, so add it for memory too. Only cover cgroupsv2 settings.
* meson: Do not include headers in source listsJan Janssen2023-01-241-36/+1
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* systemctl,test: -EBADF instead of -EBADFDYu Watanabe2023-01-211-1/+1
| | | | Follow-up for da20baaeccbcca78350bf64bdc069dec685c95bc.
* Merge pull request #23309 from DaanDeMeyer/log-contextLuca Boccassi2023-01-201-1/+1
|\ | | | | basic: Add log context
| * basic: Use statement expressions more in list.hDaan De Meyer2023-01-081-1/+1
| | | | | | | | | | Let's use statement expressions to return values instead of passing in return arguments to the LIST macros.
* | core: add GetUnitByPIDFD method and use it in systemctlLuca Boccassi2023-01-181-12/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A pid can be recycled, but a pidfd is pinned. Add a new method that is safer as it takes a pidfd as input. Return not only the D-Bus object path, but also the unit id and the last recorded invocation id, as they are both useful (especially the id, as converting from a path object to a unit id from a script requires another round-trip via D-Bus). Note that the manager still tracks processes by pid, so theorethically this is not fully error-proof, but on the other hand the method response is synchronous and the manager is single-threaded, so once a call is being processed the unit database will not change anyway. Once the manager switches to use pidfds everywhere, this can be further hardened.
* | systemctl: list-dependencies: support --type= and --state=Mike Yuan2023-01-163-4/+57
| | | | | | | | Closes #25975
* | systemctl: list-dependencies: pass bool where appropriateMike Yuan2023-01-131-1/+1
| |
* | systemctl: suppress warning about missing /proc/ when --no-warnYu Watanabe2023-01-121-7/+7
| | | | | | | | | | | | | | | | | | Follow-up for 0f958c8d4fc13ed1c1af928b2a7d91d31c7576eb. systemctl is called many times by dnf or so, and missing /proc/ is not a user's fault, but package manager's issue. With this commit, we can suppress the warning by updating rpm macros if necessary.
* | core: add OpenFile settingRichard Phibel2023-01-101-0/+33
|/
* systemctl: edit: rephrase edit markers to avoid misunderstandingMike Yuan2023-01-051-2/+2
| | | | Closes #25856
* fundamental: rework IN_SET() to require at least three argumentsLennart Poettering2023-01-021-1/+1
| | | | | | | If less than three parameters are passed a simple comparison is the better choice. Lo and behold this found two pretty bad typos.
* systemctl: rework how we detect if init is systemdLennart Poettering2022-12-231-6/+30
|
* systemctl: fix typoAntonio Alvarez Feijoo2022-12-211-1/+1
|
* systemctl: new option --drop-in for specifying drop-in filenameMike Yuan2022-12-203-2/+32
| | | | | | | | | Previously 'systemctl edit' would only operate on 'override.conf', but users may need more than that. Thus the new option '--drop-in' is added to allow users to specify the drop-in file name. Closes #25767
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-192-2/+2
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* systemctl: don't unlink non-existing temporary filesLennart Poettering2022-12-151-2/+5
|
* systemctl: if we edit a single file only, jump to the right lineLennart Poettering2022-12-151-55/+115
|
* systemctl: stop using basename() at one more placeLennart Poettering2022-12-151-4/+7
|
* systemctl: line break string where the newlines areLennart Poettering2022-12-151-2/+4
|