summaryrefslogtreecommitdiff
path: root/src/systemctl
Commit message (Collapse)AuthorAgeFilesLines
* meson: Use files() for fuzzersJan Janssen2022-01-111-3/+4
| | | | | | Not having to provide the full path in the source tree is much nicer and the produced lists can also be used anywhere in the source tree.
* systemctl: consistent output for scheduled shutdownsLudwig Nussel2022-01-101-9/+9
| | | | Use same terms when scheduling and showing sheduled shutdowns.
* systemctl: Fix --show timestampLudwig Nussel2022-01-051-1/+1
|
* systemctl: add shutdown --show optionLudwig Nussel2021-12-095-1/+49
| | | | Shows the scheduled shutdown action and time if there's one.
* systemctl: support JSON output for "show-environment"Joris Hartog2021-12-061-4/+49
| | | | | | | | This commit adds a function which converts a bus message containing the environment variables to a JSON object and uses this function to support JSON formatted output for the "systemctl show-environment" command. Fixes #21348
* systemctl: display how long a systemd service will run (#21494)Amir Omidi2021-11-301-2/+13
|
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-161-1/+1
| | | | | | | | | | Previously the mkdir_label() family of calls was implemented in src/shared/mkdir-label.c but its functions partly declared ins src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird (and wrong). Let's clean this up, and add a proper mkdir-label.h matching the .c file.
* Merge pull request #20138 from keszybz/coding-style-variable-declsLuca Boccassi2021-11-059-13/+13
|\ | | | | A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
| * Make pager_open() return voidZbigniew Jędrzejewski-Szmek2021-11-039-13/+13
| |
* | tree-wide: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-1/+1
|/ | | | | | | | (Or when -H is used, since -H and -M are incompatible.) Note that the slightly unusual form with separate boolean variables (hint_vars, hint_addr) instead of e.g. a const char* variable to hold the message, because this way we don't trigger the warning about non-literal format.
* Merge pull request #21172 from poettering/fix-systemctl-cgroup-treeLennart Poettering2021-10-291-19/+13
|\ | | | | fix "sytemctl status" cgroup tree output
| * systemctl: make sure "systemctl -M status" shows cgroup tree of container ↵Lennart Poettering2021-10-281-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | not host This shows the cgroup tree of the root slice of the container now, by querying the cgroup pid tree via the bus instead of going directly to the cgroupfs. A fallback is kept for really old systemd versions where querying the PID tree was not available. Fixes: #20958
| * systemctl: only fall back to local cgroup display if we talk to local systemdLennart Poettering2021-10-281-1/+1
| | | | | | | | | | | | Otherwise we likely show rubbish because even in local containers we nowadays have cgroup namespacing, hence we likely can't access the cgroup tree from the host at the same place as inside the container.
| * systemctl: use LESS_BY where appropriateLennart Poettering2021-10-281-10/+2
| |
| * systemctl: use empty_to_root() where appropriateLennart Poettering2021-10-281-1/+1
| |
| * systemctl: suppress second argument of ternary op where we canLennart Poettering2021-10-281-1/+1
| |
* | core: add [State|Runtime|Cache|Logs]Directory symlink as second parameterLuca Boccassi2021-10-281-0/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When combined with a tmpfs on /run or /var/lib, allows to create arbitrary and ephemeral symlinks for StateDirectory or RuntimeDirectory. This is especially useful when sharing these directories between different services, to make the same state/runtime directory 'backend' appear as different names to each service, so that they can be added/removed to a sharing agreement transparently, without code changes. An example (simplified, but real) use case: foo.service: StateDirectory=foo bar.service: StateDirectory=bar foo.service.d/shared.conf: StateDirectory= StateDirectory=shared:foo bar.service.d/shared.conf: StateDirectory= StateDirectory=shared:bar foo and bar use respectively /var/lib/foo and /var/lib/bar. Then the orchestration layer decides to stop this sharing, the drop-in can be removed. The services won't need any update and will keep working and being able to store state, transparently. To keep backward compatibility, new DBUS messages are added.
* systemctl: drop redundant "else"Yu Watanabe2021-10-281-4/+4
|
* systemctl: small fixes for MountImages pretty printingLuca Boccassi2021-10-271-10/+10
|
* systemctl: pretty-print ExtensionImages propertyLuca Boccassi2021-10-271-0/+56
| | | | Complex type, so without explicit support 'systemctl show' just prints [unprintable]
* core: add RestrictFileSystems= fragment parserIago López Galeiras2021-10-061-1/+1
| | | | | It takes an allow or deny list of filesystems services should have access to.
* basic: spit out chase_symlinks() from fs-util.[ch] → chase-symlinks.[ch]Lennart Poettering2021-10-051-0/+1
|
* variuos: add missing includesZbigniew Jędrzejewski-Szmek2021-09-221-0/+2
|
* shared: Extract common LogControl CLI code to verb-log-control.hDaan De Meyer2021-09-101-55/+7
| | | | | Let's reduce duplication by sharing common logic between all log-target/log-level verbs.
* run/mount/systemctl: don't fork off PolicyKit/ask-pw agent when in --user modeLennart Poettering2021-08-301-0/+5
| | | | | | | | When we are in --user mode there's no point in doing PolicyKit/ask-pw because both of these systems are only used by system-level services. Let's disable the two agents for that automaticlly hence. Prompted by: #20576
* Merge pull request #18385 from kinvolk/mauricio/restrict-network-interfacesLennart Poettering2021-08-201-1/+1
|\ | | | | Add RestrictNetworkInterfaces=
| * systemctl: show RestrictNetworkInterfaces= in systemctl showMauricio Vásquez2021-08-191-1/+1
| | | | | | | | Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
* | tree-wide: port things over to FORMAT_PROC_FD_PATH()Lennart Poettering2021-08-191-6/+2
|/
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-0310-12/+12
| | | | | | | | | | | | | | | | | 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.
* systemctl: allow set-property to be called with a glob patternZbigniew Jędrzejewski-Szmek2021-07-291-20/+33
| | | | | | | We call "systemctl set-property … Markers=+needs-restart" and this should also work for globs, e.g. "user@*.service" or "syncthing@*.service". https://bugzilla.redhat.com/show_bug.cgi?id=1986258
* tree-wide: FORMAT_TIMESTAMP() or friends must be used as a function argumentYu Watanabe2021-07-151-22/+15
| | | | Follow-ups for #20109.
* Merge pull request #20109 from keszybz/timestamp-macrosYu Watanabe2021-07-142-76/+51
|\ | | | | Add macros that define scratch buffer internally for timestamp/timespan formatting
| * Replace format_bytes_cgroup_protection with FORMAT_BYTES_CGROUP_PROTECTIONZbigniew Jędrzejewski-Szmek2021-07-091-3/+2
| |
| * tree-wide: add FORMAT_BYTES()Zbigniew Jędrzejewski-Szmek2021-07-091-20/+13
| |
| * tree-wide: add FORMAT_TIMESTAMP_STYLE()Zbigniew Jędrzejewski-Szmek2021-07-092-37/+27
| |
| * tree-wide: add FORMAT_TIMESTAMP_RELATIVE()Zbigniew Jędrzejewski-Szmek2021-07-091-9/+8
| |
| * tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-14/+8
| |
* | systemctl: show error when help for unknown unit is requestedZbigniew Jędrzejewski-Szmek2021-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #20189. We would only log at debug level and return failure, which looks like a noop for the user. ('help' accepts multiple arguments and will show multiple concatenated man pages in that case. Actually, it will also show multiple concatenated man pages if the Documentation= setting lists multiple pages. I don't think it's very terribly useful, but, meh, I don't think we can do much better. If a user requests a help for a two services, one known and one unknown, there'll now be a line in the output. It's not very user friendly, but not exactly wrong too.)
* | docs: improve wording when mentioning the acronym "ESP"nl67202021-07-091-1/+1
|/ | | | "ESP" is "EFI system partition", so "ESP partition" is redundant.
* dbus: extend SocketBind{Allow|Deny}= with ip protoJulia Kartseva2021-06-301-5/+14
|
* dbus: extend SocktBind{Allow|Deny}= with ip protoJulia Kartseva2021-06-151-3/+3
| | | | | | | | | | Support filtering by ip protocol (L4) in SocketBind{Allow|Deny}= properties. The signature of dbus methods must be finalized before new release is cut, hence reserve a parameter for ip protocol. Implementation will follow. Closes https://github.com/systemd/systemd/issues/19891
* Clarify help information for --globalnerdopolis2021-06-101-1/+1
|
* core: add MemoryAvailable unit propertyLuca Boccassi2021-06-081-0/+8
| | | | | | Try to infer the unused memory that a unit can claim before the memory.max limit is reached, including any limit set on any parent slice above the unit itself.
* Merge pull request #19766 from keszybz/fuzz-fixesYu Watanabe2021-06-014-10/+19
|\ | | | | Fuzz fixes
| * systemctl: unset const char* arguments in static destructorsZbigniew Jędrzejewski-Szmek2021-05-314-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When fuzzing, the following happens: - we parse 'data' and produce an argv array, - one of the items in argv is assigned to arg_host, - the argv array is subsequently freed by strv_freep(), and arg_host has a dangling symlink. In normal use, argv is static, so arg_host can never become a dangling pointer. In fuzz-systemctl-parse-argv, if we repeatedly parse the same array, we have some dangling pointers while we're in the middle of parsing. If we parse the same array a second time, at the end all the dangling pointers will have been replaced again. But for a short time, if parsing one of the arguments uses another argument, we would use a dangling pointer. Such a case occurs when we have --host=… --boot-loader-entry=help. The latter calls acquire_bus() which uses arg_host. I'm not particularly happy with making the code more complicated just for fuzzing, but I think it's better to resolve this, even if the issue cannot occur in normal invocations, than to deal with fuzzer reports. Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31714.
| * systemctl: put static destructor in the order of variablesZbigniew Jędrzejewski-Szmek2021-05-311-2/+2
| |
* | systemctl: avoid crash when pattern expands to empty unit listZbigniew Jędrzejewski-Szmek2021-05-251-0/+2
|/ | | | Fixes #19652.
* systemctl: use strextend_with_separator()Yu Watanabe2021-05-201-7/+2
|
* Merge pull request #19653 from poettering/greedy-realloc-moreLennart Poettering2021-05-195-16/+9
|\ | | | | malloc_usable_size() tweaks
| * alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-195-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)