Commit graph

994 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 1f65fd4926 basic/time-util: add helper function to check if timestamp is set
No functional change.
2019-07-04 19:12:47 +02:00
Lennart Poettering 05b2ace147
Merge pull request #12870 from yuwata/tree-wide-further-path-join-cleanups
tree-wide: further path_join() and path_joina() cleanups
2019-06-25 09:27:01 +02:00
Yu Watanabe 270384b2d4 tree-wide: replace strjoina() with prefix_roota() 2019-06-25 01:31:26 +09:00
Michal Sekletar b070c7c0e1 core: introduce NUMAPolicy and NUMAMask options
Make possible to set NUMA allocation policy for manager. Manager's
policy is by default inherited to all forked off processes. However, it
is possible to override the policy on per-service basis. Currently we
support, these policies: default, prefer, bind, interleave, local.
See man 2 set_mempolicy for details on each policy.

Overall NUMA policy actually consists of two parts. Policy itself and
bitmask representing NUMA nodes where is policy effective. Node mask can
be specified using related option, NUMAMask. Default mask can be
overwritten on per-service level.
2019-06-24 16:58:54 +02:00
Yu Watanabe 657ee2d82b tree-wide: replace strjoin() with path_join() 2019-06-21 03:26:16 +09:00
Chris Down aa91d5925a systemctl: Prevent state_missing from being used uninit 2019-06-07 06:33:35 +01:00
Yu Watanabe 042526868a
Merge pull request #12508 from keszybz/no-root-checks
Drop many root checks
2019-06-06 21:31:19 +09:00
Anita Zhang b3d593673c core: add ExecStartXYZEx= with dbus support for executable prefixes
Closes #11654
2019-05-30 20:41:42 -07:00
Frantisek Sumsal 4eb5312079 systemctl: process all units matched by a glob in the cat verb by default
Originally, `systemctl cat` would match only active units, for example:

$ systemctl cat sshd.service

would cat the sshd.service unit file even if the service was inactive.
However:

$ systemctl cat ssh*

would show it only if it was active.

Let's unify the behavior and cat all unit files regardless of a state,
if no state was given explicitly to filter.
2019-05-30 21:11:44 +02:00
Michal Sekletar a047f4f10e systemctl: present CPUAffinity mask as a list of CPU index ranges 2019-05-29 17:02:24 +02:00
Zbigniew Jędrzejewski-Szmek 4bea24696a systemctl: show a hint if root privileges might yield more information 2019-05-08 11:51:51 +02:00
Zbigniew Jędrzejewski-Szmek a004cb75c0 systemctl: drop one must_be_root_check()
(before)
$ build/systemctl list-machines
Need to be root.
$ sudo build/systemctl list-machines
NAME          STATE   FAILED JOBS
krowka (host) running      0    0
rawhide       running      0    0

2 machines listed.

(after)
$ build/systemctl list-machines
NAME          STATE   FAILED JOBS
krowka (host) running      0    0
rawhide       n/a          0    0

2 machines listed.

The output for non-root is missing some bits of information, but we display
what information is missing nicely, and e.g. in the case when no machines are
running at all, or only VMs are running, the unprivileged output would be the
same as the privileged one.
2019-05-08 11:51:51 +02:00
Ben Boeckel 5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Zbigniew Jędrzejewski-Szmek c5b7ae0edb
Merge pull request #12074 from poettering/io-acct
expose IO stats on the bus and in "systemctl status" and "systemd-run --wait"
2019-04-25 11:59:37 +02:00
Chris Down 7ad5439e06 unit: Add DefaultMemoryMin 2019-04-16 18:45:04 +01:00
Chris Down c52db42b78 cgroup: Implement default propagation of MemoryLow with DefaultMemoryLow
In cgroup v2 we have protection tunables -- currently MemoryLow and
MemoryMin (there will be more in future for other resources, too). The
design of these protection tunables requires not only intermediate
cgroups to propagate protections, but also the units at the leaf of that
resource's operation to accept it (by setting MemoryLow or MemoryMin).

This makes sense from an low-level API design perspective, but it's a
good idea to also have a higher-level abstraction that can, by default,
propagate these resources to children recursively. In this patch, this
happens by having descendants set memory.low to N if their ancestor has
DefaultMemoryLow=N -- assuming they don't set a separate MemoryLow
value.

Any affected unit can opt out of this propagation by manually setting
`MemoryLow` to some value in its unit configuration. A unit can also
stop further propagation by setting `DefaultMemoryLow=` with no
argument. This removes further propagation in the subtree, but has no
effect on the unit itself (for that, use `MemoryLow=0`).

Our use case in production is simplifying the configuration of machines
which heavily rely on memory protection tunables, but currently require
tweaking a huge number of unit files to make that a reality. This
directive makes that significantly less fragile, and decreases the risk
of misconfiguration.

After this patch is merged, I will implement DefaultMemoryMin= using the
same principles.
2019-04-12 17:23:58 +02:00
Lennart Poettering 7a5de3f951 systemctl: show IO stats in 'status' output 2019-04-12 14:25:44 +02:00
Lennart Poettering d2e1b2fd67 systemctl: print a more accurate error message when we can 2019-04-02 05:44:12 +09:00
Lennart Poettering 8a016c746e util-lib: when copying files make sure to apply some chattrs early, some late
Some chattrs only work sensible if you set them right after opening a
file for create (think: FS_NOCOW_FL). Others only work when they are
applied when the file is fully written (think: FS_IMMUTABLE_FL). Let's
take that into account when copying files and applying a chattr to them.
2019-03-28 18:43:04 +01:00
Lennart Poettering 85d9b5981b systemctl: add new --show-transaction switch
This new switch uses the new method call EnqueueUnitJob() for enqueuing
a job and showing the jobs it enqueued.

Fixes: #2297
2019-03-27 12:37:37 +01:00
Lennart Poettering 94369fc066 systemctl: split out extra args generation into helper function of its own 2019-03-27 12:37:37 +01:00
Lennart Poettering 5fd77930ad systemctl: reindent table 2019-03-27 12:37:37 +01:00
Lennart Poettering ee4296496f systemctl: more SYNTHETIC_ERRNO() conversion 2019-03-27 12:37:37 +01:00
Lennart Poettering c45e5fb877 systemctl: replace switch statement by table of structures 2019-03-27 12:37:37 +01:00
Zbigniew Jędrzejewski-Szmek 2771aaf571 systemctl: define less stuff when !HAVE_SYSV_COMPAT
We'd translate our action to sysv runlevel action, only to discard the result
in talk_initctl(). Let's just ifdef the whole thing away.

Fixes #12103.
2019-03-26 19:06:48 +01:00
Lennart Poettering 1d52a931c6 systemctl: move --failed close to --state= in help text 2019-03-25 15:25:58 +01:00
Lennart Poettering 8e54300425 systemctl: underline sections in help text
Taking inspiration from the recent commit that added that to nspawn's
help text.
2019-03-25 15:25:58 +01:00
Lennart Poettering 3bfa8668b0 systemctl: use structured initialization 2019-03-25 15:25:57 +01:00
Lennart Poettering 2f50e59f2b systemctl: use SYNTHETIC_ERRNO everywhere 2019-03-25 15:23:08 +01:00
Lennart Poettering 63a3b3cb70 systemctl: split out some SysV compat stuff into its own C file
systemctl.c is way to large already. Let's split out some stuff out that
is easy to split out.
2019-03-25 15:23:08 +01:00
Lennart Poettering 16b4623620
Merge pull request #11602 from vesajaaskelainen/dbus-reboot-with-parameters
dbus-manager: Add RebootWithParameters d-bus method
2019-03-22 21:07:47 +01:00
Vesa Jääskeläinen 77defcf538 systemctl: restore "systemctl reboot ARG" functionality
Commit d85515edcf changed logic how reboot is
executed. That commit changed behavior to use emergency action reboot code path
to perform the reboot.

This inadvertently broke rebooting with argument:
$ systemctl reboot custom-reason

Restore original behavior so that if reboot service unit similar to
systemd-reboot.service is executed it is possible to override reboot reason
with "systemctl reboot ARG".

When "systemctl reboot ARG" is executed ARG is placed in file
/run/systemd/reboot-param and reboot is issued using logind's Reboot
dbus-service.

If RebootArgument is specified in systemd-reboot.service it takes precedence
over what systemctl sets.

Fixes: #11828
2019-03-22 17:38:54 +02:00
Lennart Poettering 8d1ee64829 systemctl: make a copy of the "verb" from argv[] before forking off a child 2019-03-21 18:10:06 +01:00
Lennart Poettering 290cb8e883 systemctl: tiny optimization 2019-03-21 18:10:06 +01:00
Lennart Poettering b1dffbb91b systemctl: add missing OOM check 2019-03-21 18:10:06 +01:00
Lennart Poettering 3483460cb8 systemctl: document argv[] array 2019-03-21 18:10:06 +01:00
Lennart Poettering d86e4c979a systemctl: use saved_argv where we can
No need to have another variable where we keep the original argv[].
Let's juse reuse the one DEFINE_MAIN_FUNCTION() stores for us anyway.
2019-03-21 18:10:06 +01:00
Zbigniew Jędrzejewski-Szmek 9dd6ccf7c0
Merge pull request #12014 from poettering/systemctl-exit-fix
systemctl fallback error propagation fix
2019-03-21 17:37:09 +01:00
Lennart Poettering 2e13c0c354 systemctl: start_unit() returns > 0 on error, let's catch that properly
Let's make sure we fall back correctly to initctl when start_unit()
returns an error > 0.

Fixes: #11546
2019-03-20 15:05:27 +01:00
Lennart Poettering 9dccc6d3ae systemctl: use strv_consume() where we can 2019-03-20 14:53:07 +01:00
Lennart Poettering 61ff45db95 systemctl: port to static destructors 2019-03-20 14:53:07 +01:00
Lennart Poettering 25b1d72dcc bus-unit-util: split out code that shows a unit's process tree
The code is complex enough to deserve its own .c file. Let's split this
out.
2019-03-13 17:41:41 +01:00
Lennart Poettering e45c81b8bc shared: split out code to wait for jobs to complet into its own source file
It's complex enough and quite a few functions. Let's hence split this
out.

No code change, just some rearranging of source files.
2019-03-13 17:39:24 +01:00
Lennart Poettering aee7082fbd systemctl: drop unnecessary {} 2019-03-13 17:38:43 +01:00
Lennart Poettering 96e895efaf systemctl: use strv_consume() where appropriate 2019-03-13 17:38:43 +01:00
Lennart Poettering fb1ac50e4e systemctl: minimize scope of 'p' 2019-03-13 17:38:43 +01:00
Lennart Poettering 9a1996455e systemctl: refactor code to watch unit ActiveState a bit
let's split out one function, to make this reusable
2019-03-13 17:38:43 +01:00
Lennart Poettering cc5957dca0 bootspec: don't log in boot_entries_load_config_auto() about no ESP
Let's do it in the caller instead. That way, logind can stay silent
about it.

Fixes: #11950
2019-03-13 17:06:24 +01:00
Lennart Poettering 760877e90c util: split out sorting related calls to new sort-util.[ch] 2019-03-13 12:16:43 +01:00
Lennart Poettering 0a9707187b util: split out memcmp()/memset() related calls into memory-util.[ch]
Just some source rearranging.
2019-03-13 12:16:43 +01:00