]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agocore: initalize buffer 7738/head
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jan 2018 00:06:34 +0000 (11:06 +1100)] 
core: initalize buffer

6 years agocore: manager logs firmware and loader time when startup finished
Yu Watanabe [Mon, 25 Dec 2017 04:08:23 +0000 (13:08 +0900)] 
core: manager logs firmware and loader time when startup finished

6 years agoMerge pull request #7996 from poettering/v237-prepare
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2018 14:41:25 +0000 (17:41 +0300)] 
Merge pull request #7996 from poettering/v237-prepare

preparation for v237

6 years agofirstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)
Björn Esser [Thu, 25 Jan 2018 14:30:15 +0000 (15:30 +0100)] 
firstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)

Not every target system may provide a crypt() function in its stdlibc
and may use an external or replacement library, like libxcrypt, for
providing such functions.

See https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt.

6 years agoboot/efi: TPM V2 fix for GetEventLog EFI function
Raphael Vogelgsang [Tue, 23 Jan 2018 17:58:21 +0000 (18:58 +0100)] 
boot/efi: TPM V2 fix for GetEventLog EFI function

6 years agobus-util: fix format of NextElapseUSecRealtime= and LastTriggerUSec=
Yu Watanabe [Thu, 25 Jan 2018 08:45:53 +0000 (17:45 +0900)] 
bus-util: fix format of NextElapseUSecRealtime= and LastTriggerUSec=

Before this, `systemctl show` for calendar type timer unit outputs
something like below.
```
NextElapseUSecRealtime=48y 3w 3d 15h
NextElapseUSecMonotonic=0
LastTriggerUSec=48y 3w 3d 3h 41min 44.093095s
LastTriggerUSecMonotonic=0
```
As both NextElapseUSecRealtime= and LastTriggerUSec= are not timespan
but timestamp, this makes format these values by `format_timestamp()`.

6 years agogpt-auto: discard boot0/1 hw partitions along rpmb
Nicolas Chauvet [Wed, 24 Jan 2018 09:05:28 +0000 (10:05 +0100)] 
gpt-auto: discard boot0/1 hw partitions along rpmb

/dev/mmcblk0boot0 is a partition found in eMMC
This is not relevant for mounting

This complement the previous fix as reported in
https://github.com/systemd/systemd/issues/5806

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
6 years agomeson: bump so revision and systemd version in preparation for v237 7996/head
Lennart Poettering [Thu, 25 Jan 2018 13:18:14 +0000 (14:18 +0100)] 
meson: bump so revision and systemd version in preparation for v237

6 years agohwdb: run "update-hwdb" in preparation for v237
Lennart Poettering [Thu, 25 Jan 2018 13:16:25 +0000 (14:16 +0100)] 
hwdb: run "update-hwdb" in preparation for v237

6 years agoupdate TODO
Lennart Poettering [Thu, 25 Jan 2018 13:14:35 +0000 (14:14 +0100)] 
update TODO

6 years agoNEWS: start putting together an entry for v237
Lennart Poettering [Thu, 25 Jan 2018 12:18:28 +0000 (13:18 +0100)] 
NEWS: start putting together an entry for v237

6 years agoMerge pull request #7991 from poettering/n-on-console
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2018 10:48:08 +0000 (13:48 +0300)] 
Merge pull request #7991 from poettering/n-on-console

a comprehensive fix for the n_on_console miscounting issue

6 years agoMerge pull request #7983 from poettering/tmpfiles-eexist
Lennart Poettering [Thu, 25 Jan 2018 10:34:15 +0000 (11:34 +0100)] 
Merge pull request #7983 from poettering/tmpfiles-eexist

make "f" tmpfiles.d behaviour work like documentation suggests + coccinelle fixes

6 years agoMerge pull request #7915 from poettering/pids-max-tweak
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2018 09:24:35 +0000 (10:24 +0100)] 
Merge pull request #7915 from poettering/pids-max-tweak

6 years agoMerge pull request #7990 from poettering/log-deadlock
Lennart Poettering [Thu, 25 Jan 2018 09:06:19 +0000 (10:06 +0100)] 
Merge pull request #7990 from poettering/log-deadlock

fix for logging deadlock

6 years agocore: rework how we count the n_on_console counter 7991/head
Lennart Poettering [Wed, 24 Jan 2018 18:59:55 +0000 (19:59 +0100)] 
core: rework how we count the n_on_console counter

Let's add a per-unit boolean that tells us whether our unit is currently
counted or not. This way it's unlikely we get out of sync again and
things are generally more robust.

This also allows us to remove the counting logic specific to service
units (which was in fact mostly a copy from the generic implementation),
in favour of fully generic code.

Replaces: #7824

6 years agocore: add a new unit_needs_console() call
Lennart Poettering [Wed, 24 Jan 2018 18:54:26 +0000 (19:54 +0100)] 
core: add a new unit_needs_console() call

This call determines whether a specific unit currently needs access to
the console. It's a fancy wrapper around
exec_context_may_touch_console() ultimately, however for service units
we'll explicitly exclude the SERVICE_EXITED state from when we report
true.

6 years agomanager: minor manager_get_show_status() simplification
Lennart Poettering [Wed, 24 Jan 2018 18:52:29 +0000 (19:52 +0100)] 
manager: minor manager_get_show_status() simplification

Since the the whole function ultimately is just a fancy getter for the
show_status field, let's actually return it as last step literally
without an extra needless "if".

6 years agomanager: add some explanatory comments to manager_dispatch_idle_pipe_fd()
Lennart Poettering [Wed, 24 Jan 2018 18:52:14 +0000 (19:52 +0100)] 
manager: add some explanatory comments to manager_dispatch_idle_pipe_fd()

6 years agolog: remove LOG_TARGET_SAFE pseudo log target 7990/head
Lennart Poettering [Wed, 24 Jan 2018 17:01:01 +0000 (18:01 +0100)] 
log: remove LOG_TARGET_SAFE pseudo log target

This removes LOG_TARGET_SAFE. It's made redundant by the new
"prohibit-ipc" logging flag, as it used to have a similar effect: avoid
logging to the journal/syslog, i.e. any local services in order to avoid
deadlocks when we lock from PID 1 or its utility processes (such as
generators).

All previous users of LOG_TARGET_SAFE are switched over to the new
setting. This makes things a bit safer for all, as not even the
SYSTEMD_LOG_TARGET env var can be used to accidentally log to the
journal anymore in these programs.

6 years agolog: add brief comment for log_set_open_when_needed() and log_set_always_reopen_console()
Lennart Poettering [Wed, 24 Jan 2018 16:45:14 +0000 (17:45 +0100)] 
log: add brief comment for log_set_open_when_needed() and log_set_always_reopen_console()

These two deserve some explanation...

6 years agopid1: make use of new "prohibit_ipc" logging flag in PID 1
Lennart Poettering [Wed, 24 Jan 2018 16:42:12 +0000 (17:42 +0100)] 
pid1: make use of new "prohibit_ipc" logging flag in PID 1

Let's set it initially, and then toggle it only when we know its safe.

6 years agolog: add new "prohibit_ipc" flag to logging system
Lennart Poettering [Wed, 24 Jan 2018 16:36:25 +0000 (17:36 +0100)] 
log: add new "prohibit_ipc" flag to logging system

If set, we'll avoid logging to any IPC log targets, i.e. syslog or the
journal, but allow stderr, kmsg, console logging.

This is useful as PID 1 wants to turn this off explicitly as long as the
journal is not up.

Previously we'd open/close the log stream to these services whenever
needed but this is incompatible with the "open_when_needed" logic
introduced in #6915, which might open the log streams whenever it likes,
including possibly inside of the child process we fork off that'll
become journald later on. Hence, let's make this all explicit, and
instead of managing when we open/close log streams add a boolean that
clearly prohibits the IPC targets when needed, so that opening can be
done at any time, but will honour this.

See: #7985

6 years agolog: make log_set_upgrade_syslog_to_journal() take effect immediately
Lennart Poettering [Wed, 24 Jan 2018 16:33:07 +0000 (17:33 +0100)] 
log: make log_set_upgrade_syslog_to_journal() take effect immediately

This doesn't matter much, and we don't rely on it, but I think it's much
nicer if we log_set_target() and log_set_upgrade_syslog_to_journal() can
be called in either order and have the same effect.

6 years agoAdd fd close support to sd_event_source
Nathaniel McCallum [Wed, 24 Jan 2018 14:45:48 +0000 (09:45 -0500)] 
Add fd close support to sd_event_source

It is often the case that a file descriptor and its corresponding IO
sd_event_source share a life span. When this is the case, developers will
have to unref the event source and close the file descriptor. Instead, we
can just have the event source take ownership of the file descriptor and
close it when the event source is freed. This is especially useful when
combined with cleanup attributes and sd_event_source_unrefp().

This patch adds two new public functions:

    sd_event_source_get_io_fd_own()
    sd_event_source_set_io_fd_own()

6 years agoInclude time.h in sd-event.h
Nathaniel McCallum [Wed, 24 Jan 2018 14:53:49 +0000 (09:53 -0500)] 
Include time.h in sd-event.h

The time-related functions in sd-event.h take as inputs constants (CLOCK_*)
defined in time.h. By including time.h in sd-event.h, we free the developer
from having to do this manually.

6 years agoMerge pull request #7988 from ssahani/follow-7712
Lennart Poettering [Wed, 24 Jan 2018 15:15:26 +0000 (16:15 +0100)] 
Merge pull request #7988 from ssahani/follow-7712

Networkd: cleanup  code a bit

6 years agonetworkd: routing policy rules rename Manager object m to manager. 7988/head
Susant Sahani [Wed, 24 Jan 2018 14:57:53 +0000 (20:27 +0530)] 
networkd: routing policy rules rename Manager object m to manager.

6 years agonetworkd: remove unused variable manager -> m
Susant Sahani [Wed, 24 Jan 2018 14:57:27 +0000 (20:27 +0530)] 
networkd: remove unused variable manager -> m

6 years agohwdb: Workaround Purism Librem 13 V2 change 43 to backslash (#7984)
Ewout van Mansom [Wed, 24 Jan 2018 12:58:43 +0000 (13:58 +0100)] 
hwdb: Workaround Purism Librem 13 V2 change 43 to backslash (#7984)

hwdb: use symbolic name rather than numeric key value for Purism Librem 13 entry

Fixes: #7978
6 years agonetworkd: sd_ndisc reset mac address when MAC address change detected.
Susant Sahani [Wed, 24 Jan 2018 09:17:07 +0000 (14:47 +0530)] 
networkd: sd_ndisc reset mac address when MAC address change detected.

When there is a change in mac address we are not currently not changing
the MAC address and resulting  v6 connectivity is gone.

When kernel reports a change in mac address change the MAC of ndisc
client too.

Closes # 7806

6 years agoMerge pull request #7860 from poettering/watch-pids-rework
Lennart Poettering [Wed, 24 Jan 2018 10:18:04 +0000 (11:18 +0100)] 
Merge pull request #7860 from poettering/watch-pids-rework

rework how the manager watches PIDs

6 years agococcinelle: O_NDELAY → O_NONBLOCK 7983/head
Lennart Poettering [Wed, 24 Jan 2018 10:09:29 +0000 (11:09 +0100)] 
coccinelle: O_NDELAY → O_NONBLOCK

Apparently O_NONBLOCK is the modern name used in most documentation and
for most cases in our sources. Let's hence replace the old alias
O_NDELAY and stick to O_NONBLOCK everywhere.

6 years agococcinelle: let's use STRLEN() rather strlen() at one more place
Lennart Poettering [Wed, 24 Jan 2018 10:07:47 +0000 (11:07 +0100)] 
coccinelle: let's use STRLEN() rather strlen() at one more place

6 years agotmpfiles: make "f" lines behaviour match what the documentation says
Lennart Poettering [Wed, 24 Jan 2018 09:54:10 +0000 (10:54 +0100)] 
tmpfiles: make "f" lines behaviour match what the documentation says

CHANGE OF BEHAVIOUR — with this commit "f" line's behaviour is altered
to match what the documentation says: if an "argument" string is
specified it is written to the file only when the file didn't exist
before. Previously, it would be appended to the file each time
systemd-tmpfiles was invoked — which is not a particularly useful
behaviour as the tool is not idempotent then and the indicated files
grow without bounds each time the tool is invoked.

I did some spelunking whether this change in behaviour would break
things, but afaics nothing relies on the previous O_APPEND behaviour of
this line type, hence I think it's relatively safe to make "f" lines
work the way the docs say, rather than adding a new modifier for it or
so.

Triggered by:

https://lists.freedesktop.org/archives/systemd-devel/2018-January/040171.html

6 years agoMerge pull request #7979 from yuwata/unused-variables
Lennart Poettering [Wed, 24 Jan 2018 08:40:04 +0000 (09:40 +0100)] 
Merge pull request #7979 from yuwata/unused-variables

Small cleanups

6 years agoresolve: fix build without gcrypt 7979/head
Michael Biebl [Wed, 24 Jan 2018 03:58:04 +0000 (12:58 +0900)] 
resolve: fix build without gcrypt

Follow-up for 73a4cd17c37f61159a365e55bdd5ff2b8327d439.

Fixes #7977.

6 years agosystemctl: remove unused variable
Yu Watanabe [Wed, 24 Jan 2018 03:54:12 +0000 (12:54 +0900)] 
systemctl: remove unused variable

Follow-up for 98f609368723529a98f44948569fd2eb2dd9685d.

6 years agocore/device: remove unused variable
Yu Watanabe [Wed, 24 Jan 2018 03:52:21 +0000 (12:52 +0900)] 
core/device: remove unused variable

Follow-up for bf70ff2cff719905f9dc3f726eaba79780dcae55.

6 years agoMerge pull request #7964 from poettering/tmpfiles-more-fixes
Lennart Poettering [Tue, 23 Jan 2018 20:37:55 +0000 (21:37 +0100)] 
Merge pull request #7964 from poettering/tmpfiles-more-fixes

a number of tmpfiles fixes

6 years agoupdate TODO 7860/head
Lennart Poettering [Fri, 12 Jan 2018 14:26:11 +0000 (15:26 +0100)] 
update TODO

6 years agoservice: simplify condition
Lennart Poettering [Mon, 22 Jan 2018 16:51:53 +0000 (17:51 +0100)] 
service: simplify condition

The left side of the || expression is conditionalized on SERVICE_START,
but SERVICE_START is blanket listed on the right side anyway, hence we
can drop the left side entirely without any change in behaviour.

Moreover, if main_pid is initialized, it should be watched, hence this
is even the safe and right thing to do.

6 years agoservice: don't bother with watching PIDs during deserialization
Lennart Poettering [Mon, 22 Jan 2018 16:44:43 +0000 (17:44 +0100)] 
service: don't bother with watching PIDs during deserialization

service_coldplug() takes care of that anyway, hence drop the
unit_watch_pid() invocation entirely during serialization, it's
redundant.

6 years agocore: rework how we track which PIDs to watch for a unit
Lennart Poettering [Fri, 12 Jan 2018 12:41:05 +0000 (13:41 +0100)] 
core: rework how we track which PIDs to watch for a unit

Previously, we'd maintain two hashmaps keyed by PIDs, pointing to Unit
interested in SIGCHLD events for them. This scheme allowed a specific
PID to be watched by exactly 0, 1 or 2 units.

With this rework this is replaced by a single hashmap which is primarily
keyed by the PID and points to a Unit interested in it. However, it
optionally also keyed by the negated PID, in which case it points to a
NULL terminated array of additional Unit objects also interested. This
scheme means arbitrary numbers of Units may now watch the same PID.

Runtime and memory behaviour should not be impact by this change, as for
the common case (i.e. each PID only watched by a single unit) behaviour
stays the same, but for the uncommon case (a PID watched by more than
one unit) we only pay with a single additional memory allocation for the
array.

Why this all? Primarily, because allowing exactly two units to watch a
specific PID is not sufficient for some niche cases, as processes can
belong to more than one unit these days:

1. sd_notify() with MAINPID= can be used to attach a process from a
   different cgroup to multiple units.

2. Similar, the PIDFile= setting in unit files can be used for similar
   setups,

3. By creating a scope unit a main process of a service may join a
   different unit, too.

4. On cgroupsv1 we frequently end up watching all processes remaining in
   a scope, and if a process opens lots of scopes one after the other it
   might thus end up being watch by many of them.

This patch hence removes the 2-unit-per-PID limit. It also makes a
couple of other changes, some of them quite relevant:

- manager_get_unit_by_pid() (and the bus call wrapping it) when there's
  ambiguity will prefer returning the Unit the process belongs to based on
  cgroup membership, and only check the watch-pids hashmap if that
  fails. This change in logic is probably more in line with what people
  expect and makes things more stable as each process can belong to
  exactly one cgroup only.

- Every SIGCHLD event is now dispatched to all units interested in its
  PID. Previously, there was some magic conditionalization: the SIGCHLD
  would only be dispatched to the unit if it was only interested in a
  single PID only, or the PID belonged to the control or main PID or we
  didn't dispatch a signle SIGCHLD to the unit in the current event loop
  iteration yet. These rules were quite arbitrary and also redundant as
  the the per-unit handlers would filter the PIDs anyway a second time.
  With this change we'll hence relax the rules: all we do now is
  dispatch every SIGCHLD event exactly once to each unit interested in
  it, and it's up to the unit to then use or ignore this. We use a
  generation counter in the unit to ensure that we only invoke the unit
  handler once for each event, protecting us from confusion if a unit is
  both associated with a specific PID through cgroup membership and
  through the "watch_pids" logic. It also protects us from being
  confused if the "watch_pids" hashmap is altered while we are
  dispatching to it (which is a very likely case).

- sd_notify() message dispatching has been reworked to be very similar
  to SIGCHLD handling now. A generation counter is used for dispatching
  as well.

This also adds a new test that validates that "watch_pid" registration
and unregstration works correctly.

6 years agoMerge pull request #7968 from poettering/manager-mini-tweak
Lennart Poettering [Tue, 23 Jan 2018 20:23:19 +0000 (21:23 +0100)] 
Merge pull request #7968 from poettering/manager-mini-tweak

some manager fixes

6 years agocore: unify call we use to synthesize cgroup empty events when we stopped watching...
Lennart Poettering [Fri, 12 Jan 2018 12:06:48 +0000 (13:06 +0100)] 
core: unify call we use to synthesize cgroup empty events when we stopped watching any unit PIDs

This code is very similar in scope and service units, let's unify it in
one function. This changes little for service units, but for scope units
makes sure we go through the cgroup queue, which is something we should
do anyway.

6 years agoservice: don't send out dbus change notifications spuriously on SIGCHLD
Lennart Poettering [Fri, 12 Jan 2018 12:05:07 +0000 (13:05 +0100)] 
service: don't send out dbus change notifications spuriously on SIGCHLD

Let's send them out only if the main or control processe exited and we
recorded a new exit status that is worth reporting. But if any other
service process died this is nothing to report since we don't expose any
properties about that anyway.

6 years agocore: fix manager_get_unit_by_pid() special casing of manager PID
Lennart Poettering [Thu, 11 Jan 2018 22:38:46 +0000 (23:38 +0100)] 
core: fix manager_get_unit_by_pid() special casing of manager PID

Previously, we'd hard map PID 1 to the manager scope unit. That's wrong
however when we are run in --user mode, as the PID 1 is outside of the
subtree we manage and the manager PID might be very differently. Correct
that by checking for getpid() rather than hardcoding 1.

6 years agotest: test-process-util additions
Lennart Poettering [Thu, 11 Jan 2018 15:02:47 +0000 (16:02 +0100)] 
test: test-process-util additions

Add some extra paranoia tests that PTR_TO_PID() and PID_TO_PTR() deals
correctly with negative PID.

6 years agoprocess-util: replace PTR_TO_PID() and PID_TO_PTR macro by inline functions
Lennart Poettering [Thu, 11 Jan 2018 15:02:13 +0000 (16:02 +0100)] 
process-util: replace PTR_TO_PID() and PID_TO_PTR macro by inline functions

This way we gain some typesafety at no cost.

6 years agocgroup: fix handling of TasksAccounting= property
Lennart Poettering [Mon, 15 Jan 2018 10:33:20 +0000 (11:33 +0100)] 
cgroup: fix handling of TasksAccounting= property

6 years agoUIDS-GIDS.md: explicitly mention one more user of the overflowuid 7964/head
Lennart Poettering [Tue, 23 Jan 2018 20:16:59 +0000 (21:16 +0100)] 
UIDS-GIDS.md: explicitly mention one more user of the overflowuid

File systems with only 16bit UID support (i.e. old ext2) also use the
overflowuid to map users they can't map. Briefly mention this.

6 years agohwdb: whitespace fix to make "ninja test" work again
Lennart Poettering [Tue, 23 Jan 2018 13:32:50 +0000 (14:32 +0100)] 
hwdb: whitespace fix to make "ninja test" work again

Fixes: #7975
6 years agotmpfiles: create parent directories if they are missing for more line types
Lennart Poettering [Tue, 23 Jan 2018 13:14:19 +0000 (14:14 +0100)] 
tmpfiles: create parent directories if they are missing for more line types

Currently, we create leading directories implicitly for all lines that
create directory or directory-like nodes.

With this, we also do the same for a number of other lines: f/F, C, p,
L, c/b (that is regular files, pipes, symlinks, device nodes as well as
file trees we copy).

The leading directories are created with te default access mode of 0755.
If something else is desired, users should simply declare appropriate
"d" lines.

Fixes: #7853
6 years agotmpfiles: refuse to chown()/chmod() files which are hardlinked, unless protected_hard...
Lennart Poettering [Tue, 23 Jan 2018 13:03:34 +0000 (14:03 +0100)] 
tmpfiles: refuse to chown()/chmod() files which are hardlinked, unless protected_hardlinks sysctl is on

Let's add some extra safety.

Fixes: #7736
6 years agotmpfiles: fix check for figuring out whether to call chmod()
Lennart Poettering [Mon, 22 Jan 2018 20:11:04 +0000 (21:11 +0100)] 
tmpfiles: fix check for figuring out whether to call chmod()

No need to call chown() if everything matches already.

6 years agotmpfiles: shortcut path_set_perms() if there's nothing to do
Lennart Poettering [Mon, 22 Jan 2018 20:10:27 +0000 (21:10 +0100)] 
tmpfiles: shortcut path_set_perms() if there's nothing to do

No need to open() anything in that case, hence don't.

6 years agotmpfiles: change ownership of symlinks too
Lennart Poettering [Mon, 22 Jan 2018 20:03:53 +0000 (21:03 +0100)] 
tmpfiles: change ownership of symlinks too

Ownership is supported for symlinks, too, only file modes are not.
Support that too.

Fixes: #7509
6 years agoMerge pull request #7965 from poettering/local-gateways-fix
Lennart Poettering [Tue, 23 Jan 2018 20:15:15 +0000 (21:15 +0100)] 
Merge pull request #7965 from poettering/local-gateways-fix

netlink fixes, including better determination of the default gateway, to fix #7854

6 years agoresolve: signal Ed25519 support (#7960)
ott [Tue, 23 Jan 2018 20:13:05 +0000 (21:13 +0100)] 
resolve: signal Ed25519 support (#7960)

Ed25519 is supported but not signalled as an understood cryptographic
algorithm as per RFC 6975.

6 years agoMerge pull request #7971 from poettering/dev-node-fixes
Yu Watanabe [Tue, 23 Jan 2018 19:27:27 +0000 (04:27 +0900)] 
Merge pull request #7971 from poettering/dev-node-fixes

small follow-up for #7886

6 years agonamepace: fix error handling when clone_device_node() returns 0 7971/head
Lennart Poettering [Tue, 23 Jan 2018 18:37:59 +0000 (19:37 +0100)] 
namepace: fix error handling when clone_device_node() returns 0

Before this patch, we'd treat clone_device_node() returning 0 (as
opposed to 1) as error, but then propagate this non-error result in
confusion.

This makes sure that if we ptmx isn't around we propagate that as
-ENXIO.

This is a follow-up for 98b1d2b8d9ea27087a5980b4b902b6a6ab716e03

6 years agoMerge pull request #7969 from poettering/stream-fd
Lennart Poettering [Tue, 23 Jan 2018 18:41:57 +0000 (19:41 +0100)] 
Merge pull request #7969 from poettering/stream-fd

man: minor improvements regarding journal API descriptions

6 years agonamespace: use is_symlink() helper
Lennart Poettering [Tue, 23 Jan 2018 18:36:55 +0000 (19:36 +0100)] 
namespace: use is_symlink() helper

We have this prett ylittle helper, let's use it, it makes things a tiny
bit more readable.

6 years agonamespace: use stack allocation for paths, where we can
Lennart Poettering [Tue, 23 Jan 2018 18:36:36 +0000 (19:36 +0100)] 
namespace: use stack allocation for paths, where we can

6 years agoman: it appears the description of async signal safety has its own man page now 7969/head
Lennart Poettering [Tue, 23 Jan 2018 18:09:54 +0000 (19:09 +0100)] 
man: it appears the description of async signal safety has its own man page now

Let's refer to the new page.

6 years agojournal: cast to (void) where we knowingly ignore syscall returns
Lennart Poettering [Tue, 23 Jan 2018 18:07:06 +0000 (19:07 +0100)] 
journal: cast to (void) where we knowingly ignore syscall returns

6 years agoman: document explicitly that sd_journal_stream_fd() never shares fds
Lennart Poettering [Tue, 23 Jan 2018 18:06:21 +0000 (19:06 +0100)] 
man: document explicitly that sd_journal_stream_fd() never shares fds

Also, clarify that O_NONBLOCK is turned off and that the fd is only
half-open.

6 years agoMerge pull request #7939 from npmccallum/implicit
Lennart Poettering [Tue, 23 Jan 2018 17:47:38 +0000 (18:47 +0100)] 
Merge pull request #7939 from npmccallum/implicit

Implicitly resolve default contexts in sd-event and sd-bus

6 years agopid1: rework how we dispatch SIGCHLD and other signals 7968/head
Lennart Poettering [Tue, 23 Jan 2018 17:18:13 +0000 (18:18 +0100)] 
pid1: rework how we dispatch SIGCHLD and other signals

This fundamentally makes one change: we never process more than one
signal or more than one waitid() event per event loop. We'll never tight
loop around waitid() or around read() on our signalfd instead, but
always return to the main event loop after processing one event.

By doing this we put the event priorization handling into full power
again, as we'll always check for higher priority events before looking
at the next signal or waitid() again.

This introduces a new "defer" event source "sigchld_event". It's enabled
as soon as we see SIGCHLD, and disabled as soon as waitid() reported no
further children pending. It's running at a relatively high priority,
one step higher than signal handling itself, but lower than
/proc/self/mountinfo event handling, so that the latter always takes
precedence.

Since we want to process sd_notify() events at an even higher priority
than SIGCHLD (as before) it is moved one priority step up, too.

Fixes: #7932
Possibly fixes: #7966

6 years agocore: move user lookup event priority to -11
Lennart Poettering [Tue, 23 Jan 2018 17:15:16 +0000 (18:15 +0100)] 
core: move user lookup event priority to -11

This is internal stuff, us talking to ourselves and relatively
independent of everything else, let's put this at
highest priority hence.

6 years agomount,swap: write event loop priority as "SD_EVENT_PRIORITY_NORMAL-x"
Lennart Poettering [Tue, 23 Jan 2018 17:13:01 +0000 (18:13 +0100)] 
mount,swap: write event loop priority as "SD_EVENT_PRIORITY_NORMAL-x"

We do that in all other cases, let's do it here too. Since
SD_EVENT_PRIORITY_NORMAL evaluates to zero there's zero effective
difference, but it makes things easier to grok and grep for if we always
express relative priorities within PID 1 only.

6 years agomanager: add MANAGER_IS_RUNNING() for checking whether the manager is running
Lennart Poettering [Tue, 23 Jan 2018 15:43:56 +0000 (16:43 +0100)] 
manager: add MANAGER_IS_RUNNING() for checking whether the manager is running

This macro is useful as the check is not obvious, and we better abstract
this away.

6 years agomanager: split out send_ready and basic.target checking into functions of their own
Lennart Poettering [Tue, 23 Jan 2018 15:32:06 +0000 (16:32 +0100)] 
manager: split out send_ready and basic.target checking into functions of their own

Let's shorten manager_check_finished() a bit by splitting out checking
of basic.target and the two things we do when we reach it.

This should not change behaviour, except for one thing: we now check
basic.target's actual state for figuring out whether it is up, instead
of generically checking whether it has any job queued. This is arguably
more correct, and is what other code does too for similar purposes, for
example manager_state()

6 years agoMerge pull request #7834 from jkloetzke/disable-watchdog
Lennart Poettering [Tue, 23 Jan 2018 14:58:17 +0000 (15:58 +0100)] 
Merge pull request #7834 from jkloetzke/disable-watchdog

core: add "disable watchdog " function

6 years agolocal-addresses: handle gracefully if routes lack an RTA_OIF attribute 7965/head
Lennart Poettering [Tue, 23 Jan 2018 14:48:28 +0000 (15:48 +0100)] 
local-addresses: handle gracefully if routes lack an RTA_OIF attribute

Some routes (such as those using "nexthop") don't have an RTA_OIF
attribute. We need to handle that gracefully, by simply ignoring the
route.

Fixes: #7854
6 years agotest-local-addresses: turn on debug logging by default
Lennart Poettering [Tue, 23 Jan 2018 14:47:56 +0000 (15:47 +0100)] 
test-local-addresses: turn on debug logging by default

This is a test, we should hence debug log.

6 years agosd-netlink: minor coding style updates
Lennart Poettering [Tue, 23 Jan 2018 14:47:18 +0000 (15:47 +0100)] 
sd-netlink: minor coding style updates

nothing really relevant

6 years agoAdd support for SD_BUS_DEFAULT* 7939/head
Nathaniel McCallum [Mon, 22 Jan 2018 21:26:44 +0000 (16:26 -0500)] 
Add support for SD_BUS_DEFAULT*

Currently, sd-bus supports the ability to have thread-local default busses.
However, this is less useful than it can be since all functions which
require an sd_bus* as input require the caller to pass it. This patch adds
a new macro which allows the developer to pass a constant SD_BUS_DEFAULT,
SD_BUS_DEFAULT_USER or SD_BUS_DEFAULT_SYSTEM instead. This reduces work for
the caller.

For example:

    r = sd_bus_default(&bus);
    r = sd_bus_call_method(bus, ...);
    sd_bus_unref(bus);

Becomes:

    r = sd_bus_call_method(SD_BUS_DEFAULT, ...);

If the specified thread-local default bus does not exist, the function
calls will return -ENOPKG. No bus will ever be implicitly created.

6 years agoAdd support for SD_EVENT_DEFAULT
Nathaniel McCallum [Mon, 22 Jan 2018 20:38:07 +0000 (15:38 -0500)] 
Add support for SD_EVENT_DEFAULT

Currently, sd-event supports the ability to have a thread-local default
event loop. However, this is less useful than it can be since all functions
which require an sd_event* as input require the caller to pass it. This
patch adds a new macro which allows the developer to pass a constant
SD_EVENT_DEFAULT instead. This reduces work for the caller.

For example:

    r = sd_event_default(&e);
    r = sd_event_add_io(e, ...);
    sd_event_unref(e);

Becomes:

    r = sd_event_add_io(SD_EVENT_DEFAULT, ...);

If no thread-local default event loop exists, the function calls will
return -ENOPKG. No event loop will ever be implicitly created.

6 years agoMerge pull request #7940 from sourcejedi/mount
Lennart Poettering [Tue, 23 Jan 2018 12:45:24 +0000 (13:45 +0100)] 
Merge pull request #7940 from sourcejedi/mount

mount rationalization

6 years agosd-dhcp6-client: Fix DHCPv6 client file descriptor handling
Patrik Flykt [Tue, 23 Jan 2018 10:34:31 +0000 (12:34 +0200)] 
sd-dhcp6-client: Fix DHCPv6 client file descriptor handling

The DHCPv6 client will set its state to DHCP6_STATE_STOPPED if
an error occurs or when receiving an Information Reply DHCPv6
message. Once in DHCP6_STATE_STOPPED, the DHCPv6 client needs
to be restarted by calling sd_dhcp6_client_start().

As of pull request #7796 client_reset() no longer closes the
network socket, thus a call to sd_dhcp6_client_start() needs to
check whether the file descriptor already exists in order not to
create a new one. Likewise, a call to sd_dhcp6_client_unref()
must now close the network socket as client_reset() is not
closing it.

Reported by asavah and Yu Watanabe.

6 years agomount: don't consider activated until /sbin/mount returns 7940/head
Alan Jenkins [Sat, 20 Jan 2018 20:12:09 +0000 (20:12 +0000)] 
mount: don't consider activated until /sbin/mount returns

So far, we considered mount units activated as soon as the mount
appeared.  This avoided seeing a difference between mounts started by
systemd, and e.g. by running `mount` from a terminal.
(`umount` was not handled this way).

However in some cases, options passed to `mount` require additional
system calls after the mount is successfully created.  E.g. the
`private` mount option, or the `ro` option on bind mounts.
It seems best to wait for mount to finish doing that.  E.g. in
the `private` case, the current behaviour could theoretically cause
non-deterministic results, as child mounts inherit the
private/shared propagation setting from their parent.

This also avoids a special case in mount_reload().

6 years agomount: clarify that umount retries do not (anymore) allow multiple timeouts
Alan Jenkins [Mon, 22 Jan 2018 17:42:25 +0000 (17:42 +0000)] 
mount: clarify that umount retries do not (anymore) allow multiple timeouts

It _looks_ as if, back when we used to retry unsuccessful calls to umount,
this would have inflated the effective timeout.  Multiplying it by
RETRY_UMOUNT_MAX.  Which is set to 32.

I'm surprised if it's true: I would have expected it to be noticed during
the work on NFS timeouts.  But I can't see what would have stopped it.

Clarify that I do not expect this to happen anymore.  I think each
individual umount call is allowed up to the full timeout, but if umount
ever exited with a signal status, we would stop retrying.

To be extra clear, make sure that we do not retry in the event that umount
perversely returned EXIT_SUCCESS after receiving SIGTERM.

6 years agomount: mountinfo event is supposed to always arrive before SIGCHLD
Alan Jenkins [Sat, 20 Jan 2018 20:05:52 +0000 (20:05 +0000)] 
mount: mountinfo event is supposed to always arrive before SIGCHLD

"Due to the io event priority logic we can be sure the new mountinfo is
loaded before we process the SIGCHLD for the mount command."

I think this is a reasonable expectation.  But if it works, then the
other comment must be false:

"Note that mount(8) returning and the kernel sending us a mount table
change event might happen out-of-order."

Therefore we can clean up the code for the latter.

If this is working as advertised, then we can make sure that mount units
fail if the mount we thought we were creating did not actually appear,
due to races or trickery (or because /sbin/mount did something unexpected
despite returning EXIT_SUCCESS).

Include a specific warning message for this failure.

If we give up when the mount point is still mounted after 32 successful
calls to /sbin/umount, that seems a fairly similar case.  So make that
message a LOG_WARN as well (not LOG_DEBUG). Also, this was recently changed to only
retry while umount is returning EXIT_SUCCESS; in that case in particular
there would be no other messages in the log to suggest what had happened.

6 years agohwdb: map zoomin/out keys to up/down
Martin Pitt [Mon, 22 Jan 2018 20:17:08 +0000 (21:17 +0100)] 
hwdb: map zoomin/out keys to up/down

Some keyboards come with a zoom see-saw or rocker which until now got
mapped to the Linux "zoomin/out" keys in hwdb. However, these keycodes
are not recognized by any major desktop. They now produce Up/Down key
events so that they can be used for scrolling.

The internet is full of instructions how to "unbreak" these keys, e. g.

  https://askubuntu.com/questions/471802/make-the-zoom-slider-of-microsoft-natural-ergonomic-keyboard-4000-and-7000-scrol
  https://unix.stackexchange.com/questions/322075/how-to-get-ms-natural-ergonomic-4000-slider-work-on-linux-mint

So let's make it official. But keep their physical meaning in comments
in case desktops start to do something useful with them at some point.

Thanks to Finn Christiansen for the original patch!

Replaces #6953

6 years agohwdb: Add Microsoft Sculpt Comfort Mouse data (#7946)
Maciej S. Szmigiero [Tue, 23 Jan 2018 05:25:24 +0000 (06:25 +0100)] 
hwdb: Add Microsoft Sculpt Comfort Mouse data (#7946)

This adds measured Microsoft Sculpt Comfort (Bluetooth) Mouse data to hwdb.

6 years agoresolve: Adjust and unify D-Bus call timeout (#7847)
ott [Tue, 23 Jan 2018 00:53:31 +0000 (01:53 +0100)] 
resolve: Adjust and unify D-Bus call timeout (#7847)

DNS queries have a timeout of DNS_TRANSACTION_ATTEMPTS_MAX *
DNS_TIMEOUT_MAX_USEC = 120 s. Calls to the ResolveHostname method of
the org.freedesktop.resolve1.Manager interface have various call
timeouts that are smaller than 120 s. So it seems correct to adjust
the call timeout to the maximum query timeout and to unify the call
timeout among all callers.

A timeout of 120 s might seem large, in particular since BIND does seem
to have a query timeout of 10 s. However, it seems match the timeout
value of 120 s of Unbound. Moreover, the query and timeout handling of
resolve have problems and might be improved in the future, so this
change is at best an interim solution.

6 years agohwdb: Added sensor geometry for Jumper EZpad 6 Pro (#7955)
lbernstone [Tue, 23 Jan 2018 00:51:11 +0000 (17:51 -0700)] 
hwdb: Added sensor geometry for Jumper EZpad 6 Pro (#7955)

6 years agoloopback-setup: update log message (#7956)
Yu Watanabe [Tue, 23 Jan 2018 00:50:30 +0000 (09:50 +0900)] 
loopback-setup: update log message (#7956)

This makes not log "Failed to ..." when each operation succeeds.

Fixes #7930.

6 years agohwdb: readded accelerometer orientation entry for AsusTek TP500LB (#7958)
Gianluca Boiano [Tue, 23 Jan 2018 00:50:09 +0000 (01:50 +0100)] 
hwdb: readded accelerometer orientation entry for AsusTek TP500LB (#7958)

6 years agohwdb: add Ideazon Zboard Merc and Ideazon Zboard Fang (#6954)
Olivier Schwander [Mon, 22 Jan 2018 20:41:11 +0000 (21:41 +0100)] 
hwdb: add Ideazon Zboard Merc and Ideazon Zboard Fang (#6954)

6 years agobash-completion: systemd-analyze: add service-watchdogs verb 7834/head
Jan Klötzke [Mon, 22 Jan 2018 20:39:57 +0000 (21:39 +0100)] 
bash-completion: systemd-analyze: add service-watchdogs verb

6 years agoMerge pull request #7719 from gdamjan/efistub-LoaderImageIdentifier
Lennart Poettering [Mon, 22 Jan 2018 19:41:22 +0000 (20:41 +0100)] 
Merge pull request #7719 from gdamjan/efistub-LoaderImageIdentifier

EFI stub: add LoaderImageIdentifier, LoaderFirmwareInfo, LoaderFirmwareType and StubInfo

6 years agoMerge pull request #7952 from poettering/tmpfiles-tweaks
Lennart Poettering [Mon, 22 Jan 2018 19:33:40 +0000 (20:33 +0100)] 
Merge pull request #7952 from poettering/tmpfiles-tweaks

Some tmpfiles tweaks

6 years agosystemctl: replace manual GetAll call with bus_map_all_properties() in unit_exists()
Reverend Homer [Mon, 22 Jan 2018 15:04:44 +0000 (18:04 +0300)] 
systemctl: replace manual GetAll call with bus_map_all_properties() in unit_exists()

6 years agofix reload propagation for device alias
Jérémy Rosen [Sat, 6 Jan 2018 21:55:22 +0000 (22:55 +0100)] 
fix reload propagation for device alias

udev-made .device aliases are not normal alias

They are full-fledged units which are linked to
the same sysfs path

we need to explicitely propagate reload to all
alias

6 years agosystemd-analyze: add service-watchdogs verb
Jan Klötzke [Thu, 11 Jan 2018 09:44:38 +0000 (10:44 +0100)] 
systemd-analyze: add service-watchdogs verb

New debug verb that enables or disables the service runtime watchdogs
and emergency actions during runtime. This is the systemd-analyze
version of the systemd.service_watchdogs command line option.

6 years agopid1: add option to disable service watchdogs
Jan Klötzke [Mon, 20 Mar 2017 12:10:43 +0000 (13:10 +0100)] 
pid1: add option to disable service watchdogs

Add a "systemd.service_watchdogs=" option to the command line which
disables all service runtime watchdogs and emergency actions.

6 years agojournal: Fix journal dumping for json, cat and export output
Armin Widegreen [Thu, 11 Jan 2018 11:42:56 +0000 (12:42 +0100)] 
journal: Fix journal dumping for json, cat and export output

Incorporating the fix from d00f1d57 into other output formats of journalctl.

If journal files are corrupted, e.g. not cleanly closed, some journal
entries can not be read by output options other than 'short' (default).
If such entries has been identified, they will now just be skipped.