1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-13 17:18:18 +03:00

36595 Commits

Author SHA1 Message Date
Lennart Poettering
4e96eb682c logind: also expose bool prop on bus that declares whether we are on external power
The three core variables that affect idleness handling are whether we
are docked, whether we are on AC power and whether the lid is closed,
hence let's also expose the third variable on the bus, to make things
nicely debuggable.
2018-11-16 15:39:31 +01:00
Lennart Poettering
e455380b18 logind: make sure that if we can't figure out whether we are on AC we presume we are
It's safer to assume that we are on AC than to assume we are on battery,
if we can't figure it out.
2018-11-16 15:39:31 +01:00
Lennart Poettering
c30e0d7b6a logind: don't claim that RebootToFirmwareSetup was constant
It's not, after all, that's what SetRebootToFirmware() is about.

(I was wondering for a moment whether to make this EMITS_CHANGES, but
decided against it, given that the flag actually can be changed
externally to logind too, and we couldn't send out notifications for
that.)
2018-11-16 15:39:31 +01:00
Lennart Poettering
9b9c23daf4 logind: expose a boolean on the bus explaining whether logind thinks the lid is closed
This copies how we already expose a "Docked" boolean the reflects
whether we are in a docking station or not.
2018-11-16 15:39:31 +01:00
Lennart Poettering
ff30a86bd4 job: simplify status message extraction
As @keszybz points out these fields are always here, there's no point in
checking if they are NULL or not.
2018-11-16 15:30:36 +01:00
Lennart Poettering
9a80f2f453 job: when a job was skipped due to a failed condition, log about it
Previously we'd neither show console status output nor log output. Let's
fix that, and still log something.
2018-11-16 15:30:36 +01:00
Lennart Poettering
6e64994d69 core: make unit_start() return a distinguishable error code in case conditions didn't hold
Ideally we'd even propagate this all the way to the client, by having a
separate JobType enum value for this. But it's hard to add this without
breaking compat, hence for now let's at least internally propagate this
case differently from the case "already on it".

This is then used to call job_finish_and_invalidate() slightly
differently, with the already= parameter false, as in the failed
condition case no message was likely produced so far.
2018-11-16 15:22:48 +01:00
Lennart Poettering
0e2b4a822e job: add two explanatory comments 2018-11-16 15:22:48 +01:00
Lennart Poettering
a69b3872ac job: let's remove one comparison and reduce indentation level by one 2018-11-16 15:22:48 +01:00
Lennart Poettering
523ee2d414 core: log a recognizable message when a unit succeeds, too
We already are doing it on failure, let's do it on success, too.

Fixes: #10265
2018-11-16 15:22:48 +01:00
Lennart Poettering
91bbd9b796 core: make log messages about unit processes exiting recognizable 2018-11-16 15:22:48 +01:00
Lennart Poettering
7c047d7443 core: make log messages about units entering a 'failed' state recognizable
Let's make this recognizable, and carry result information in a
structure fashion.
2018-11-16 15:22:48 +01:00
Lennart Poettering
295f31b0b7 sd-messages: add comment and reorder a bit
The message SD_MESSAGE_UNIT_FAILED is closely related to
SD_MESSAGE_UNIT_STARTED as it is generated when a start job failed
instead of completed successfully, Hence they should be placed together.

Otherwise one might get the impression that the message was about
failing units, which it really is not.
2018-11-16 15:22:48 +01:00
Lennart Poettering
0b999d34b1 catalog: update job begin/done messages
These texts have been slightly misleading previously, as they talked
about units, not jobs, but are actually generated for jobs, not units.
This difference matters as units can change state without a job
requesting that.

Also, the message be02cf6855d2428ba40df7e9d022f03d was particularly
wrong, as it claimed the unit failed, while it actually is the start job
that failed, which is a major difference, as jobs can fail without the
unit actually being placed in a failed state. Let's move this message a
bit up, closed to 39f53479d3a045ac8e11786248231fbf (i.e. the message
seen when a start job finished successfully).
2018-11-16 15:22:48 +01:00
Lennart Poettering
b344b363ce job: also include job ID in log messages when we begin with a job 2018-11-16 15:22:48 +01:00
Lennart Poettering
33a3fdd978 core: move unit_status_emit_starting_stopping_reloading() and related calls to job.c
This call is only used by job.c and very specific to job handling.
Moreover the very similar logic of job_emit_status_message() is already
in job.c.

Hence, let's clean this up, and move both sets of functions to job.c,
and rename them a bit so that they express precisely what they do:

1. unit_status_emit_starting_stopping_reloading() →
   job_emit_begin_status_message()
2. job_emit_status_message() → job_emit_done_status_message()

The first call is after all what we call when we begin with the
execution of a job, and the second call what we call when we are done
wiht it.

Just some moving and renaming, not other changes, and hence no change in
behaviour.
2018-11-16 15:22:48 +01:00
Lennart Poettering
f8c34706f5 job: add log message when we can't enable the job run event source 2018-11-16 15:22:48 +01:00
Lennart Poettering
8ebd9175db job: add comment for EAGAIN job run case 2018-11-16 15:22:48 +01:00
Lennart Poettering
ea2c0e4526 job: minor coding style tweaks 2018-11-16 15:22:48 +01:00
Lennart Poettering
1cd81629e1 job: include JOB_ID field in log message about jobs 2018-11-16 15:22:48 +01:00
Evgeny Vereshchagin
a7891d203c tests: run fuzzers four times in a row (#10794)
This should help to catch issues that are easily detectable by
bad_build_check like the one being fixed in https://github.com/systemd/systemd/pull/10793,
which would totally break the build tomorrow if I hadn't run
`helper.py check_build` manually.
2018-11-16 23:09:24 +09:00
Yu Watanabe
ff4b032106 sd-ndisc: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
144faa8ea5 sd-ndisc: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
807a8edeb1 sd-radv: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
78f9d24f7b sd-radv: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
6ec11d46dc lldp: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
8158b90d59 lldp: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
32ab66c5ee ipv4acd: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
4ca5acb35f ipv4acd: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
c9393e8c41 dhcp6-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
8b8ecac85b dhcp6-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Benjamin Berg
a5f07d2a16 sd-dhcp6: fix crash by unrefing event sources before re-adding them
In certain cases the timeouts may not have been unref'ed before they
need to be re-added. Add the appropriate unref calls to ensure we don't
register the timeout multiple times.

This fixes possible cases where timeouts are triggered multiple times
and even on destroyed DHCPv6 clients.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/73

Fixes #10749.
2018-11-16 22:57:42 +09:00
Yu Watanabe
a3fa4287f5 dhcp-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
be6bf4a786 dhcp-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
0725c4b9d1 udevd: use event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe
6d63048a77 udevd: use event_reset_time() to update kill_workers_event 2018-11-16 22:57:42 +09:00
Yu Watanabe
d44325cb96 sd-event: also introduce event_source_is_enabled() 2018-11-16 22:57:42 +09:00
Yu Watanabe
2701983ce8 sd-event: introduce event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe
764c08e6b7 sd-event: introduce event_reset_time() 2018-11-16 22:57:42 +09:00
Yu Watanabe
a137a1c3ff sd-event: split definition of event_source to event-source.h 2018-11-16 22:57:37 +09:00
Lennart Poettering
f54353406a update TODO 2018-11-16 14:54:13 +01:00
Lennart Poettering
e353faa0d6 cgroup-util: when attaching/creating cgroups in multiple hierarchies, take jointly mounted controlelrs into account
If we create a cgroup in one controller it might already have been
created in another too, if we have jointly mounted controllers. Take
that into consideration.
2018-11-16 14:54:13 +01:00
Lennart Poettering
fae9bc298a cgroup: when determining which controllers we need, always extend the mask according to cpu/cpuacct joint mounting
Note that for cgroup_context_get_mask() this doesn't actually change
much, but it does prepare the ground for #10507 later on.
2018-11-16 14:54:13 +01:00
Lennart Poettering
c01ef321af cgroup: add new helper that knows which controllers are mounted together 2018-11-16 14:54:13 +01:00
Lennart Poettering
143fadf369 core: remove JoinControllers= configuration setting
This removes the ability to configure which cgroup controllers to mount
together. Instead, we'll now hardcode that "cpu" and "cpuacct" are
mounted together as well as "net_cls" and "net_prio".

The concept of mounting controllers together has no future as it does
not exist to cgroupsv2. Moreover, the current logic is systematically
broken, as revealed by the discussions in #10507. Also, we surveyed Red
Hat customers and couldn't find a single user of the concept (which
isn't particularly surprising, as it is broken...)

This reduced the (already way too complex) cgroup handling for us, since
we now know whenever we make a change to a cgroup for one controller to
which other controllers it applies.
2018-11-16 14:54:13 +01:00
Lennart Poettering
8d33dca2ff core: fix capitalization of CPUShares= settings 2018-11-16 14:46:49 +01:00
Lennart Poettering
63a0cbbac3 cgtop: use FOREACH_STRING() for fun and profit 2018-11-16 14:46:49 +01:00
Lennart Poettering
fdaa23af94 cgtop: use automatic clean-up 2018-11-16 14:46:49 +01:00
Lennart Poettering
ac0a94f743 sd-bus: make strict asan shut up
asan doesn't like it if we use strndup() (i.e. a string function) on a
non-NULL terminated buffer (i.e. something that isn't really a string).

Let's hence use memdup_suffix0() instead of strndup(), which is more
appropriate for binary data that is to become a string.

Fixes: #10385
2018-11-16 14:32:41 +01:00
Lennart Poettering
899feb7225 man: let's deprecate PermissionsStartOnly=
The concept is redundant and predates the special chars that do the same
in ExecStar=. Let's settle on advertising just the latter, and hide
PermissionsStartOnly= from the docs (even if we continue supporting it).
2018-11-16 14:31:37 +01:00