platform/upstream/systemd.git
6 years agoman: clarify that the controllers listed on Delegate= might not be the only ones
Lennart Poettering [Mon, 20 Nov 2017 11:40:08 +0000 (12:40 +0100)]
man: clarify that the controllers listed on Delegate= might not be the only ones

6 years agotest: add a test case that validates cgroup delegation
Lennart Poettering [Fri, 17 Nov 2017 19:06:26 +0000 (20:06 +0100)]
test: add a test case that validates cgroup delegation

This test runs on the unified hierarchy, and ensures that cgroup
delegation works properly, i.e. writ access is granted and the requested
controllers are enabled.

6 years agocgroup: fix delegation on the unified hierarchy
Lennart Poettering [Fri, 17 Nov 2017 18:25:18 +0000 (19:25 +0100)]
cgroup: fix delegation on the unified hierarchy

Make sure to add the delegation mask to the mask of controllers we have
to enable on our own unit. Do not claim it was a members mask, as such
a logic would mean we'd collide with cgroupv2's "no processes on inner
nodes policy".

This change does the right thing: it means any controller enabled
through Controllers= will be made available to subcrgoups of our unit,
but the unit itself has to still enable it through
cgroup.subtree_control (which it can since that file is delegated too)
to be inherited further down.

Or to say this differently: we only should manipulate
cgroup.subtree_control ourselves for inner nodes (i.e. slices), and
for leaves we need to provide a way to enable controllers in the slices
above, but stay away from the cgroup's own cgroup.subtree_control —
which is what this patch ensures.

Fixes: #7355

6 years agocgroup: properly determine cgroups zombie processes belong to
Lennart Poettering [Fri, 17 Nov 2017 18:24:06 +0000 (19:24 +0100)]
cgroup: properly determine cgroups zombie processes belong to

When a process becomes a zombie its cgroup might be deleted. Let's add
some minimal code to detect cases like this, so that we can still
attribute this back to the original cgroup.

6 years agocgroup-util: optimization — open subtree_control file only once for all controllers
Lennart Poettering [Fri, 17 Nov 2017 17:03:22 +0000 (18:03 +0100)]
cgroup-util: optimization — open subtree_control file only once for all controllers

6 years agoupdate TODO
Lennart Poettering [Fri, 17 Nov 2017 17:03:00 +0000 (18:03 +0100)]
update TODO

6 years agocore: unify common code for preparing for forking off unit processes
Lennart Poettering [Fri, 17 Nov 2017 15:43:08 +0000 (16:43 +0100)]
core: unify common code for preparing for forking off unit processes

This introduces a new function unit_prepare_exec() that encapsulates a
number of calls we do in preparation for spawning off some processes in
all our unit types that do so.

This allows us to neatly unify a bit of code between unit types and
shorten our code.

6 years agocgroup-util: move Set* allocation into cg_kernel_controllers()
Lennart Poettering [Fri, 17 Nov 2017 15:27:13 +0000 (16:27 +0100)]
cgroup-util: move Set* allocation into cg_kernel_controllers()

Previously, callers had to do this on their own. Let's make the call do
that instead, making the caller code a bit shorter.

6 years agonspawn: minor optimization
Lennart Poettering [Fri, 17 Nov 2017 12:42:58 +0000 (13:42 +0100)]
nspawn: minor optimization

no need to prepare the target path if we quite the loop anyway one step
later.

6 years agonspawn-mount: rework get_controllers() a bit
Lennart Poettering [Fri, 17 Nov 2017 12:35:56 +0000 (13:35 +0100)]
nspawn-mount: rework get_controllers() a bit

Let's rename get_controllers() → get_process_controllers(), in order to
underline the difference to cg_kernel_controllers(). After all, one
returns the controllers available to the process, the other the
controllers enabled in the kernel at all).

Let's also update the code to use read_line() and set_put_strdup() to
shorten the code a bit, and make it more robust.

6 years agonspawn: rework mount_systemd_cgroup_writable() a bit
Lennart Poettering [Fri, 17 Nov 2017 12:05:30 +0000 (13:05 +0100)]
nspawn: rework mount_systemd_cgroup_writable() a bit

We shouldn't call alloca() as part of function calls, that's not really
defined in C. Hence, let's first do our stack allocations, and then
invoke functions.

Also, some coding style fixes, and minor shuffling around.

No functional changes.

6 years agocgroup: move cgroup controller names def.h → cgroup-util.h
Lennart Poettering [Fri, 17 Nov 2017 12:02:14 +0000 (13:02 +0100)]
cgroup: move cgroup controller names def.h → cgroup-util.h

These definitions are clearly cgroup specific, hence let's move them out
of def.h

6 years agonetworkd: cleanup do not call link_enter_set_routes after label is set. (#6935)
Susant Sahani [Tue, 21 Nov 2017 10:54:14 +0000 (16:24 +0530)]
networkd: cleanup do not call link_enter_set_routes after label is set. (#6935)

Remove link_enter_set_routes after label is set.

6 years agonetworkd: support incoming/outgoing device for rule matching (#7223)
Susant Sahani [Tue, 21 Nov 2017 10:51:50 +0000 (16:21 +0530)]
networkd: support incoming/outgoing device for rule matching (#7223)

Closes #7210

6 years agoshared: silence gcc warning (#7402)
Shawn Landden [Tue, 21 Nov 2017 07:24:12 +0000 (23:24 -0800)]
shared: silence gcc warning (#7402)

[346/1860] Compiling C object 'src/shared/systemd-shared-235@sha/firewall-util.c.o'.
../src/shared/firewall-util.c: In function ‘entry_fill_basics’:
../src/shared/firewall-util.c:81:79: warning: logical ‘and’ of equal expressions [-Wlogical-op]
[543/1860] Compiling C object 'src/shared/systemd-shared-235@sta/firewall-util.c.o'.
../src/shared/firewall-util.c: In function ‘entry_fill_basics’:
../src/shared/firewall-util.c:81:79: warning: logical ‘and’ of equal expressions [-Wlogical-op]

6 years agoNEWS: fix minor error (#7399)
Shawn Landden [Tue, 21 Nov 2017 02:05:57 +0000 (18:05 -0800)]
NEWS: fix minor error (#7399)

6 years agohwdb: Add ACCEL_MOUNT_MATRIX for the Acer Aspire Switch 10 convertible
lukas [Mon, 20 Nov 2017 12:43:48 +0000 (13:43 +0100)]
hwdb: Add ACCEL_MOUNT_MATRIX for the Acer Aspire Switch 10 convertible
SW5-012 (#7394)

6 years agotest: fall back to /boot if bootctl -p fails (#7397)
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 19:08:11 +0000 (20:08 +0100)]
test: fall back to /boot if bootctl -p fails (#7397)

It doesn't really matter why.

6 years agonetworkd: configure link even if no routes have been received by dhcp (#6886)
Susant Sahani [Mon, 20 Nov 2017 18:23:34 +0000 (23:53 +0530)]
networkd: configure link even if no routes have been received by dhcp (#6886)

Fixes #3752

 networkctl
IDX LINK             TYPE               OPERATIONAL SETUP
  1 lo               loopback           carrier     unmanaged
  2 eth0             ether              no-carrier  configuring
  5 host             ether              routable    configured <==========

5 links listed.

6 years agoMerge pull request #6910 from ssahani/issue-6359
Lennart Poettering [Mon, 20 Nov 2017 18:21:36 +0000 (19:21 +0100)]
Merge pull request #6910 from ssahani/issue-6359

networkd: For IPv6 addresses do not treat IFA_F_DEPRECATED as not ready. (Fix #6359)

6 years agoMerge pull request #6918 from ssahani/issue-5625
Lennart Poettering [Mon, 20 Nov 2017 18:20:23 +0000 (19:20 +0100)]
Merge pull request #6918 from ssahani/issue-5625

networkd: ndisc - do not stop ndisc client incase of conf error.

6 years agonetworkd: address - support for /31 IPv4 addresses (rfc3021) (#6938)
Susant Sahani [Mon, 20 Nov 2017 18:16:01 +0000 (23:46 +0530)]
networkd: address - support for /31 IPv4 addresses (rfc3021) (#6938)

When configuring a network address with /31 using networkd, a /31 without a
broadcast specified should be present.

 A /31 which has neither a network nor a broadcast address. See
https://tools.ietf.org/html/rfc3021

Fixes #4038

6 years agonetworkd: Do not send requests to create netdevs if they exists. (#6973)
Susant Sahani [Mon, 20 Nov 2017 17:58:06 +0000 (23:28 +0530)]
networkd: Do not send requests to create netdevs if they exists. (#6973)

If the netdev already exists we should not send requests to
kernel to create them.

fixes #5448

6 years agonetworkd: Set RoutingPolicyRule in link_configure (#7235)
Susant Sahani [Mon, 20 Nov 2017 16:50:48 +0000 (22:20 +0530)]
networkd: Set RoutingPolicyRule in link_configure (#7235)

The RoutingPolicyRules are not added when we are calling from set_address
the link->message++ and link->message-- never reaches to zero in the callback function
resulting routes are never gets added.

Closes #7200

6 years agoMerge pull request #7375 from poettering/readme-updates
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 13:46:02 +0000 (14:46 +0100)]
Merge pull request #7375 from poettering/readme-updates

some README updates

6 years agoman: fix description of --force in halt(8) (#7392)
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 13:27:46 +0000 (14:27 +0100)]
man: fix description of --force in halt(8) (#7392)

https://bugzilla.redhat.com/show_bug.cgi?id=1449751

6 years agoMerge pull request #7154 from keszybz/bootspec
Lennart Poettering [Mon, 20 Nov 2017 12:06:33 +0000 (13:06 +0100)]
Merge pull request #7154 from keszybz/bootspec

List bootspec entries in bootctl and use the default for kexec

6 years agoMerge pull request #7387 from yuwata/fix-7370
Lennart Poettering [Mon, 20 Nov 2017 11:51:40 +0000 (12:51 +0100)]
Merge pull request #7387 from yuwata/fix-7370

core: load() should fail when the corresponding unit file does not exist

6 years agoREADME,sysusers: complete and order list of default udev groups we need
Lennart Poettering [Mon, 20 Nov 2017 11:30:42 +0000 (12:30 +0100)]
README,sysusers: complete and order list of default udev groups we need

Let's make sure the list of default udev groups we need are ordered in
README and in the sysusers.d snippet, and both are complete.

6 years agoREADME: slightly update the section about split /usr
Lennart Poettering [Fri, 17 Nov 2017 10:39:48 +0000 (11:39 +0100)]
README: slightly update the section about split /usr

It's fine if /usr is actually on a separate fs. What matters is that it
is mounted early enough. Say so.

6 years agoREADME: document that prefix *must* be /usr and nss-systemd is not an option
Lennart Poettering [Fri, 17 Nov 2017 10:39:14 +0000 (11:39 +0100)]
README: document that prefix *must* be /usr and nss-systemd is not an option

See: #7374

6 years agomeson: add -Wimplicit-fallthrough=3 to compilation options (#7393)
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 11:14:47 +0000 (12:14 +0100)]
meson: add -Wimplicit-fallthrough=3 to compilation options (#7393)

At some point before gcc-7 was released, -Wimplicit-fallthrough=3 was included
in -Wextra. The documentation for gcc-7.2.1-2.fc27.x86_64 still says that, but
empirical testing shows that it's not. The documentation also misstates that
-Wimplicit-fallthrough is equivalent to -Wimplicit-fallthrough=3.

Let's add -Wimplicit-fallthrough=3 explicitly to get the warnings if we regress.

Prompted by #7389.

6 years agoMerge pull request #7373 from poettering/analyze-calendar
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 10:25:55 +0000 (11:25 +0100)]
Merge pull request #7373 from poettering/analyze-calendar

add nifty little "systemd-analyze calendar" command

6 years agosystemctl: elapsation → elapse
Lennart Poettering [Mon, 20 Nov 2017 09:54:21 +0000 (10:54 +0100)]
systemctl: elapsation → elapse

6 years agoupdate TODO
Lennart Poettering [Fri, 17 Nov 2017 09:34:52 +0000 (10:34 +0100)]
update TODO

6 years agoanalyze: add new "calendar" command
Lennart Poettering [Fri, 17 Nov 2017 09:33:22 +0000 (10:33 +0100)]
analyze: add new "calendar" command

This little new command can parse, validate, normalize calendar events,
and calculate when they will elapse next. This should be useful for
anyone writing calendar events and who'd like to validate the expression
before running them as timer units.

6 years agoman: Requires= stops this unit when dependencies get deactivated (#7391)
John Lin [Mon, 20 Nov 2017 09:55:52 +0000 (17:55 +0800)]
man: Requires= stops this unit when dependencies get deactivated (#7391)

Fixes: #7372

6 years agoutil: add new helper in_utc_timezone()
Lennart Poettering [Mon, 20 Nov 2017 09:52:20 +0000 (10:52 +0100)]
util: add new helper in_utc_timezone()

As the name suggests it checks whether we are running in an UTC
timezone.

6 years agocalendarspec: rework destructor to return its own type
Lennart Poettering [Fri, 17 Nov 2017 09:32:48 +0000 (10:32 +0100)]
calendarspec: rework destructor to return its own type

Let's make it more alike most of our other destructors.

6 years agomeson: bump required meson version to 0.41 (#7385)
Zbigniew Jędrzejewski-Szmek [Mon, 20 Nov 2017 07:08:43 +0000 (08:08 +0100)]
meson: bump required meson version to 0.41 (#7385)

We need data_dirs argument for i18n.merge_file, added in 0.40.1-11-g82492f5d76.

6 years agocore/swap: load() should fail when neither of corresponding unit file nor /proc/swap...
Yu Watanabe [Sun, 19 Nov 2017 16:00:34 +0000 (01:00 +0900)]
core/swap: load() should fail when neither of corresponding unit file nor /proc/swap entry does not exist

It is not necessary to label as loaded to a swap unit when neither of
corresponding unit file nor entry in /proc/swap does not exist.
This makes swap_load() to fail such a case.

Partially fixes #7370.

6 years agocore/automount: load() should fail when the unit file does not exist
Yu Watanabe [Sun, 19 Nov 2017 07:45:35 +0000 (16:45 +0900)]
core/automount: load() should fail when the unit file does not exist

It is not necessary to label as loaded to automount unit when its unit
file does not exist. So, let's make automount_load() to fail when the
unit file does not exist.

Partially fixes #7370.

6 years agoMerge pull request #7376 from keszybz/simplify-root-options
Lennart Poettering [Sun, 19 Nov 2017 18:50:03 +0000 (19:50 +0100)]
Merge pull request #7376 from keszybz/simplify-root-options

Simplify root configuration options

6 years agoMerge pull request #7198 from poettering/stdin-stdout
Lennart Poettering [Sun, 19 Nov 2017 18:49:11 +0000 (19:49 +0100)]
Merge pull request #7198 from poettering/stdin-stdout

Add StandardInput=data, StandardInput=file:... and more

6 years agoMerge pull request #7379 from yuwata/follow-up-7309
Lennart Poettering [Sun, 19 Nov 2017 18:47:24 +0000 (19:47 +0100)]
Merge pull request #7379 from yuwata/follow-up-7309

networkd: small fixes

6 years agoMerge pull request #7386 from keszybz/spdx
Lennart Poettering [Sun, 19 Nov 2017 18:46:52 +0000 (19:46 +0100)]
Merge pull request #7386 from keszybz/spdx

Add some missing license headers and add SPDX identifiers

6 years agoAdd license headers and SPDX identifiers to meson.build files
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 17:32:01 +0000 (18:32 +0100)]
Add license headers and SPDX identifiers to meson.build files

So far I avoided adding license headers to meson files, but they are pretty
big and important and should carry license headers like everything else.
I added my own copyright, even though other people modified those files too.
But this is mostly symbolic, so I hope that's OK.

6 years agoAdd SPDX license headers to shell completion scripts
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 17:21:19 +0000 (18:21 +0100)]
Add SPDX license headers to shell completion scripts

6 years agoAdd SPDX license headers to various assorted files
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 17:18:16 +0000 (18:18 +0100)]
Add SPDX license headers to various assorted files

6 years agoAdd missing headers and SPDX identifiers to man pages
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:52:56 +0000 (17:52 +0100)]
Add missing headers and SPDX identifiers to man pages

6 years agoAdd SPDX license headers to unit files
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:35:03 +0000 (17:35 +0100)]
Add SPDX license headers to unit files

6 years agoAdd SPDX license headers to python scripts
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:32:46 +0000 (17:32 +0100)]
Add SPDX license headers to python scripts

6 years agoAdd SPDX indentifier to hwdb/parse_hwdb.py
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:26:32 +0000 (17:26 +0100)]
Add SPDX indentifier to hwdb/parse_hwdb.py

6 years agoAdd SPDX license identifiers to man pages
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:22:32 +0000 (17:22 +0100)]
Add SPDX license identifiers to man pages

6 years agoAdd SPDX license identifiers to catalog and po files
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:17:35 +0000 (17:17 +0100)]
Add SPDX license identifiers to catalog and po files

6 years agoAdd SPDX license identifiers to source files under the GPL
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:14:42 +0000 (17:14 +0100)]
Add SPDX license identifiers to source files under the GPL

6 years agoAdd SPDX license identifiers to source files under the LGPL
Zbigniew Jędrzejewski-Szmek [Sat, 18 Nov 2017 16:09:20 +0000 (17:09 +0100)]
Add SPDX license identifiers to source files under the LGPL

This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.

6 years agoMerge pull request #7388 from keszybz/doc-tweak
Lennart Poettering [Sun, 19 Nov 2017 16:50:35 +0000 (17:50 +0100)]
Merge pull request #7388 from keszybz/doc-tweak

Add link to kernel docs about no_new_privs and drop note about CPU controller

6 years agomachined: support "machinectl bind" on non-directories (#7349)
Lennart Poettering [Sun, 19 Nov 2017 13:23:29 +0000 (14:23 +0100)]
machined: support "machinectl bind" on non-directories (#7349)

Fixes: #7195

6 years agoman: remove note about CPU controller being unmerged
Zbigniew Jędrzejewski-Szmek [Sun, 19 Nov 2017 13:15:42 +0000 (14:15 +0100)]
man: remove note about CPU controller being unmerged

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0d5936344f30aba0f6ddb92b030cb6a05168efe6

In principle we shouldn't merge this until after 4.15 is released, but the
chances of a revert upstream are low, and in that unlikely scenario we can just
revert this patch, it's a trivial documentation update after all.

6 years agoMerge pull request #7365 from poettering/nspawn-bind-userns
Zbigniew Jędrzejewski-Szmek [Sun, 19 Nov 2017 13:01:39 +0000 (14:01 +0100)]
Merge pull request #7365 from poettering/nspawn-bind-userns

nspawn: document --bind= and --private-users relationship, and make recursive chown()ing safe

6 years agotest: do not hardcode location of EFI partition
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 13:09:11 +0000 (14:09 +0100)]
test: do not hardcode location of EFI partition

6 years agobootctl: add a convenient way to print the path to EFI
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 12:55:05 +0000 (13:55 +0100)]
bootctl: add a convenient way to print the path to EFI

6 years agobootctl: rename r2 and r to r and k
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 12:50:08 +0000 (13:50 +0100)]
bootctl: rename r2 and r to r and k

r2 was assigned first despite the name. This scheme is different than
what is used elsewhere in the code. Rename to make it easier to read.

6 years agosystemctl: make sure the kernel is loaded before kexec'ing
Zbigniew Jędrzejewski-Szmek [Sat, 21 Oct 2017 08:55:32 +0000 (10:55 +0200)]
systemctl: make sure the kernel is loaded before kexec'ing

We just load the same kernel that would be loaded by default by sd-boot, with
the same options. Changing the kernel or initramfs or options is left for
later.

Now we will refuse to continue if loading fails. This makes 'systemctl kexec'
more predictable: it will not fall back to normal reboot if the kernel is
not loaded.

6 years agoman: add link to kernel docs about no_new_privs
Zbigniew Jędrzejewski-Szmek [Sun, 19 Nov 2017 10:58:45 +0000 (11:58 +0100)]
man: add link to kernel docs about no_new_privs

6 years agonetworkd: fix indentation
Yu Watanabe [Fri, 17 Nov 2017 16:24:07 +0000 (01:24 +0900)]
networkd: fix indentation

6 years agonetworkd: remove debug message and unref when error
Yu Watanabe [Fri, 17 Nov 2017 16:22:34 +0000 (01:22 +0900)]
networkd: remove debug message and unref when error

Follow-up for 8006aa32ee29538ef1d7978d60d6427a0bf31e80.

6 years agocore: be more defensive if we can't determine per-connection socket peer (#7329)
Lennart Poettering [Fri, 17 Nov 2017 14:22:11 +0000 (15:22 +0100)]
core: be more defensive if we can't determine per-connection socket peer (#7329)

Let's handle gracefully if a client disconnects very early on.

This builds on #4120, but relaxes the condition checks further, since we
getpeername() might already fail during ExecStartPre= and friends.

Fixes: #7172

6 years agoman: rescue.target could be seen as single-user.target (#7323)
John Lin [Fri, 17 Nov 2017 14:20:48 +0000 (22:20 +0800)]
man: rescue.target could be seen as single-user.target (#7323)

6 years agoman: document that start limiting of GC'ed units doesn't work (#7337)
Lennart Poettering [Fri, 17 Nov 2017 14:18:30 +0000 (15:18 +0100)]
man: document that start limiting of GC'ed units doesn't work (#7337)

Fixes: #7139

6 years agoMerge pull request #7360 from poettering/preset-fix
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 14:00:22 +0000 (15:00 +0100)]
Merge pull request #7360 from poettering/preset-fix

Some fixes for preset-all logic at boot, plus main.c reworking

6 years agoMerge pull request #7338 from poettering/doc-restart-fix
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 13:51:51 +0000 (14:51 +0100)]
Merge pull request #7338 from poettering/doc-restart-fix

improve unit restart documentation a bit

6 years agomeson: use absolute path for rpmmacrosdir
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 12:22:13 +0000 (13:22 +0100)]
meson: use absolute path for rpmmacrosdir

This only matter for the status display at the end of configure step.
Now it looks like:
         RPM macros dir:                    /usr/lib/rpm/macros.d

6 years agomeson: drop rootprefix option
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 12:07:46 +0000 (13:07 +0100)]
meson: drop rootprefix option

rootprefixdir is now always set to /usr or /, based on the split-usr setting.
Anything else does not work anyway.

C.f. #7375.

6 years agoinstall: when we encounter a transient/generated unit while presetting all, skip...
Lennart Poettering [Thu, 16 Nov 2017 11:30:33 +0000 (12:30 +0100)]
install: when we encounter a transient/generated unit while presetting all, skip over it silently

Fixes: #7100

6 years agomain: uid_to_name() might theoretically fail, handle that
Lennart Poettering [Thu, 16 Nov 2017 11:24:32 +0000 (12:24 +0100)]
main: uid_to_name() might theoretically fail, handle that

6 years agocore: shorten main() a bit, split out coredump initialization
Lennart Poettering [Thu, 16 Nov 2017 11:02:39 +0000 (12:02 +0100)]
core: shorten main() a bit, split out coredump initialization

No functional changes.

6 years agomain: let's make main() shorter, let's split out clock initialization
Lennart Poettering [Thu, 16 Nov 2017 10:58:08 +0000 (11:58 +0100)]
main: let's make main() shorter, let's split out clock initialization

no functional changes

6 years agomain: let's make main() shorter, let's split out invocation of shutdown binary
Lennart Poettering [Thu, 16 Nov 2017 10:54:53 +0000 (11:54 +0100)]
main: let's make main() shorter, let's split out invocation of shutdown binary

No functional changes

6 years agocore: let's shorten main() a bit, let's split out telinit redirection into a separate...
Lennart Poettering [Thu, 16 Nov 2017 10:48:45 +0000 (11:48 +0100)]
core: let's shorten main() a bit, let's split out telinit redirection into a separate function

6 years agomain: add set_manager_settings(), similar in style to set_manager_defaults()
Lennart Poettering [Thu, 16 Nov 2017 10:45:02 +0000 (11:45 +0100)]
main: add set_manager_settings(), similar in style to set_manager_defaults()

6 years agocore: never apply first boot presets in the initrd
Lennart Poettering [Wed, 15 Nov 2017 18:56:21 +0000 (19:56 +0100)]
core: never apply first boot presets in the initrd

Presets are useful to initialize uninitialized /etc, but that doesn't
apply to the initrd.

Also, let's rename etc_empty → first_boot. After all, the variable
doesn't actually reflect whether /etc is really empty, it just reflects
whether /etc/machine-id existed originally or not. Moreover, we later on
directly initialize manager_set_first_boot() from it, hence let's just
name it the same way all through the codepath, to make this all less
confusing.

See: #7100

6 years agomain: rename manager_set_defaults() → set_manager_defaults()
Lennart Poettering [Wed, 15 Nov 2017 19:15:01 +0000 (20:15 +0100)]
main: rename manager_set_defaults() → set_manager_defaults()

This function is really not a method of the Manager object (implemented
in manager.c), but just a helper in main.c. Hence let's not confusingly
name it the way methods are called.

6 years agoupdate TODO
Lennart Poettering [Wed, 15 Nov 2017 10:25:38 +0000 (11:25 +0100)]
update TODO

6 years agoman: document that ExecStop= is executed during restarts
Lennart Poettering [Wed, 15 Nov 2017 10:25:19 +0000 (11:25 +0100)]
man: document that ExecStop= is executed during restarts

Fixes: #7126

6 years agoman: add missing suffixing "=" for setting name
Lennart Poettering [Wed, 15 Nov 2017 10:24:51 +0000 (11:24 +0100)]
man: add missing suffixing "=" for setting name

6 years agoman: write "stop and start" instead of "restart" when explaining the reload fallback...
Lennart Poettering [Wed, 15 Nov 2017 10:23:00 +0000 (11:23 +0100)]
man: write "stop and start" instead of "restart" when explaining the reload fallback operations

We already made a similar change when talking about the "restart"
command, let's also do this for "systemctl reload" and friends.

Follow-up for: 6539dd7c42946d9ba5dc43028b8b5785eb2db3c5

See: #7126

6 years agoman: document the interaction of "systemctl restart" and the FD store
Lennart Poettering [Wed, 15 Nov 2017 10:22:25 +0000 (11:22 +0100)]
man: document the interaction of "systemctl restart" and the FD store

See: #7126

6 years agoupdate TODO
Lennart Poettering [Fri, 27 Oct 2017 17:01:21 +0000 (19:01 +0200)]
update TODO

6 years agoman: document all the new options we acquired
Lennart Poettering [Fri, 27 Oct 2017 16:10:34 +0000 (18:10 +0200)]
man: document all the new options we acquired

6 years agofs-util: rename path_is_safe() → path_is_normalized()
Lennart Poettering [Fri, 27 Oct 2017 14:28:15 +0000 (16:28 +0200)]
fs-util: rename path_is_safe() → path_is_normalized()

Already, path_is_safe() refused paths container the "." dir. Doing that
isn't strictly necessary to be "safe" by most definitions of the word.
But it is necessary in order to consider a path "normalized". Hence,
"path_is_safe()" is slightly misleading a name, but
"path_is_normalize()" is more descriptive, hence let's rename things
accordingly.

No functional changes.

6 years agocore: don't allow DefaultStandardOutput= be set to socket/fd:/file:
Lennart Poettering [Fri, 27 Oct 2017 14:22:38 +0000 (16:22 +0200)]
core: don't allow DefaultStandardOutput= be set to socket/fd:/file:

These three settings only make sense within the context of actual unit
files, hence filter this out when applied to the per-manager default,
and generate a log message about it.

6 years agotest: add basic test for StandardInput=file:
Lennart Poettering [Fri, 27 Oct 2017 14:16:19 +0000 (16:16 +0200)]
test: add basic test for StandardInput=file:

6 years agocore: add exec_context_dump() support for fd: and file: stdio settings
Lennart Poettering [Fri, 27 Oct 2017 14:13:59 +0000 (16:13 +0200)]
core: add exec_context_dump() support for fd: and file: stdio settings

This was missing for using fdnames as stdio, let's add support for
fdnames as well as file paths in one go.

6 years agocore: add support for StandardInputFile= and friends
Lennart Poettering [Fri, 27 Oct 2017 14:09:57 +0000 (16:09 +0200)]
core: add support for StandardInputFile= and friends

These new settings permit specifiying arbitrary paths as
stdin/stdout/stderr locations. We try to open/create them as necessary.
Some special magic is applied:

1) if the same path is specified for both input and output/stderr, we'll
   open it only once O_RDWR, and duplicate them fd instead.

2) If we an AF_UNIX socket path is specified, we'll connect() to it,
   rather than open() it. This allows invoking systemd services with
   stdin/stdout/stderr connected to arbitrary foreign service sockets.

Fixes: #3991

6 years agocore: fix handling of transient StandardOutputFileDescriptorName= and friends
Lennart Poettering [Fri, 27 Oct 2017 14:08:11 +0000 (16:08 +0200)]
core: fix handling of transient StandardOutputFileDescriptorName= and friends

Let's make sure to process the fdname first, before changing the actual
input/output setting, since the fdname part can fail due to OOM.

This way we don't leave half-initialized bits around.

6 years agoexecute: some extra asserts
Lennart Poettering [Fri, 27 Oct 2017 12:59:05 +0000 (14:59 +0200)]
execute: some extra asserts

In some cases we checked for fd validity already explicitly, let's do
this for all our fds.

6 years agocore: fold property_get_input_fdname() and property_get_output_fdname() into one
Lennart Poettering [Fri, 27 Oct 2017 12:57:12 +0000 (14:57 +0200)]
core: fold property_get_input_fdname() and property_get_output_fdname() into one

property_get_output_fdname() already had two different control flows for
stdout and stderr, it might as well handle stdin too, thus shortening
our code a bit.

6 years agoexecute: fix type of open_terminal_as() flags parameter
Lennart Poettering [Fri, 27 Oct 2017 12:32:22 +0000 (14:32 +0200)]
execute: fix type of open_terminal_as() flags parameter

It's the flags parameter we propagate here, not the mode parameter,
hence let's name it properly, and use the right type.