Commit graph

3759 commits

Author SHA1 Message Date
Anita Zhang 31cd5f63ce core: ExecCondition= for services
Closes #10596
2019-07-17 11:35:02 +02:00
Lennart Poettering c1b71f3a61
Merge pull request #13074 from poettering/format-tree-many
table_add_many() improvements
2019-07-16 16:03:54 +02:00
Lennart Poettering 4119ad492f
Merge pull request #13073 from poettering/variety-galore
Variety galore
2019-07-16 15:59:31 +02:00
Zbigniew Jędrzejewski-Szmek 0f18289954
Merge pull request #13062 from yuwata/analyze-use-table
systemd-analyze: use Table
2019-07-16 13:28:34 +02:00
Lennart Poettering 6268974f88 format-table: add ability to set cell attributes within table_add_many()
table_add_many() is so much shorter and easier to read than
table_add_cell() with its accessors. Let's teach table_add_many() more
tricks, so that reverting to table_add_cell() is not needed that often
anymore.
2019-07-16 12:43:46 +02:00
Lennart Poettering dc0e9c9ba6 format-table: fix parameter name 2019-07-16 12:42:19 +02:00
Lennart Poettering 525e9b7991 shared: no need to check result of strndupa() 2019-07-16 12:40:22 +02:00
Lennart Poettering 9228fef0d6 tree-wide: use empty-to-root a bit more 2019-07-16 12:40:22 +02:00
Lennart Poettering f200a3564c
Merge pull request #13063 from keszybz/cgroup-path-fixes
Cgroup path fixes
2019-07-16 11:53:31 +02:00
Yu Watanabe 8cec0a5c32 tree-wide: drop duplicated blank lines
```
$ for i in */*.[ch] */*/*.[ch]; do sed -e '/^$/ {N; s/\n$//g}' -i $i; done
$ git checkout HEAD -- basic/linux shared/linux
```
2019-07-15 18:41:27 +02:00
Zbigniew Jędrzejewski-Szmek 107c20518b systemctl: emit warning when we get an invalid process entry from pid1 and continue
Output looks like this:
Invalid process description in GetUnitProcesses reply: cgroup="machine.slice/machine-rawhide.scope/payload/system.slice/systemd-journald.service" pid=638367 command="/usr/lib/systemd/systemd-journald", ignoring: Invalid argument
2019-07-15 18:39:05 +02:00
Yu Watanabe c5bbb2b5be format-table: add TABLE_TIMESTAMP_UTC and _RELATIVE 2019-07-16 00:44:14 +09:00
Yu Watanabe ba99f19c0d format-table: add TABLE_TIMESPAN_MSEC 2019-07-16 00:09:39 +09:00
Yu Watanabe f7f196adfa
Merge pull request #13037 from poettering/shutdown-log-fixes
Shutdown log fixes
2019-07-13 23:00:12 +09:00
Lennart Poettering 6a47f2a714 sysctl: add sysctl_writef() helper 2019-07-13 11:05:07 +02:00
Lennart Poettering 2caa38e99f tree-wide: some more [static] related fixes
let's add [static] where it was missing so far

Drop [static] on parameters that can be NULL.

Add an assert() around parameters that have [static] and can't be NULL
hence.

Add some "const" where it was forgotten.
2019-07-12 16:40:10 +02:00
Lennart Poettering 27dd6e1b12
Merge pull request #13022 from keszybz/coverity-cleanups
Coverity cleanups
2019-07-12 07:37:44 +02:00
Lennart Poettering b910cc72c0 tree-wide: get rid of strappend()
It's a special case of strjoin(), so no need to keep both. In particular
as typing strjoin() is even shoert than strappend().
2019-07-12 14:31:12 +09:00
Zbigniew Jędrzejewski-Szmek 8e9d1eece6 shared/ask-password-api: backspace all chars at once
We'd call loop_write() separately for each char. Let's be nice to
serial console users, and write the full string in one go.

Coverity was complaining that we're not checking the return value
from loop_write(). Rework the code a bit and add voidify.
CID#1402323.
2019-07-12 00:35:05 +02:00
Lennart Poettering 66855de739 tree-wide: make use of errno_or_else() everywhere 2019-07-11 23:20:31 +02:00
Lennart Poettering 10859c4902
Merge pull request #12176 from poettering/clean-dir2
add "systemctl clean" operation for clearing out StateDirectory=, CacheDirectory=, … of a service unit
2019-07-11 15:12:02 +02:00
Lennart Poettering 2eb1c19881 json: always allocate at least sizeof(JsonVariant) bytes
ubsan apparently doesn't like us being too smart here. Given the
difference is just a few bytes, let's avoid the noise.

Fixes: #13020
2019-07-11 15:10:33 +02:00
Lennart Poettering 3572d3df8f shared: add generic logic for waiting for a unit to enter some state
This is a generic implementation of a client-side logic of waiting until
a unit enters or leaves some state.

This is a more generic implementation of the WaitContext logic currently
in systemctl.c, and is supposed to replace it (a later commit does
this). It's similar to bus-wait-for-jobs.c and we probably should fold
that one into it later on.

This code is more powerful and cleaner than the WaitContext logic
however. In addition to waiting for a unit to exit this also allows us
to wait for a unit to leave the "maintainance" state.

This commit only implements the generic logic, and adds no users of it
yet.
2019-07-11 12:18:51 +02:00
Yu Watanabe bb08b2a940
Merge pull request #13010 from poettering/fsck-usr-wants
generator: downgrade Requires= → Wants= of fsck from /usr mount unit
2019-07-11 15:13:51 +09:00
Lennart Poettering 08945b59d1
Merge pull request #12926 from keszybz/urlify-logs
Urlify CONFIG_FILE and improve SYSTEMD_LOG_LOCATION
2019-07-11 00:00:34 +02:00
Lennart Poettering bdd0f4b6d1
Merge pull request #13009 from keszybz/efi-feature-xbootldr
sd-boot feature xbootldr
2019-07-11 00:00:12 +02:00
Lennart Poettering 6f209cb01d
Merge pull request #12965 from keszybz/auto-erase
_cleanup_(erase_and_freep)
2019-07-10 16:20:50 +02:00
Lennart Poettering a082157282
Merge pull request #13005 from keszybz/fix-gcc-warning
Fix two gcc warnings
2019-07-10 16:20:31 +02:00
Lennart Poettering afacf3fc8a generator: downgrade Requires= → Wants= of fsck from /usr mount unit
Fixes #5099
2019-07-10 16:19:31 +02:00
Lennart Poettering cbdc9cfe2b core: spaces rock 2019-07-10 16:19:31 +02:00
Zbigniew Jędrzejewski-Szmek 91b08bb00f boot,shared: share the definitions of EFI_LOADER_FEATURE macros
This means the the code needs to be kept compatible in the shared header,
but I think that still nicer than having two places to declare the same
things.

I added src/boot to -I, so that efi/foo.h needs to be used. This reduces
the potential for accidentally including the wrong header.
2019-07-10 14:59:48 +02:00
Lennart Poettering ba40f0399e
Merge pull request #12939 from yuwata/lgtm-fixes
make LGTM quiet
2019-07-10 14:57:14 +02:00
Zbigniew Jędrzejewski-Szmek 79dc477f2f shared/logs-show: urlify CONFIG_FILE in verbose mode
Now all short-*, verbose, with-unit modes are handled. cat, export, json-* are
not, but those are usually used for post-processing, so I don't think it'd be
useful there.
2019-07-10 14:20:09 +02:00
Zbigniew Jędrzejewski-Szmek 76f7cc3fe4 shared/logs-show: urlify CONFIG_FILE in short mode
v2:
- check that the filename is terminated by ':', ' ', or EOS
- fix grep highlight overlap check
2019-07-10 14:19:26 +02:00
Zbigniew Jędrzejewski-Szmek e693a93235 Use _cleanup(free_and_erasep) where appropriate
Replaces #12959.
2019-07-10 11:39:03 +02:00
Zbigniew Jędrzejewski-Szmek 706fb34851 shared/dm-util: use strncpy_exact() to silence gcc
With gcc-9.1.1-2.fc31.x86_64 and -Doptimization=2:
../src/shared/dm-util.c: In function ‘dm_deferred_remove’:
../src/shared/dm-util.c:35:9: warning: ‘strncpy’ specified bound 128 equals destination size [-Wstringop-truncation]
   35 |         strncpy(dm.name, name, sizeof(dm.name));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gcc is plain wrong here, because we checked strlen(name) a few lines above, so
there can be no truncation and even the terminator always fits. But let's avoid
the warning.
2019-07-10 10:32:39 +02:00
Zbigniew Jędrzejewski-Szmek 6490a017e2
Merge pull request #12964 from yuwata/network-bridge-vlan-issue-12958
network: fix BridgeVLAN issue
2019-07-05 13:58:21 +02:00
Yu Watanabe fb721f084c network: re-implement parse_vid_range() 2019-07-05 16:35:06 +09:00
Lennart Poettering 7e69d90c8d varlink: add varlink server to event loop only if there is one 2019-07-04 22:53:49 +02:00
Yu Watanabe d14be488a7 firewall-util: use fixed size array for chain name
xt_chainlabel is defined as
```
typedef char xt_chainlabel[32];
```
2019-07-05 02:45:00 +09:00
Yu Watanabe 4bbccb02ea tree-wide: introduce strerror_safe() 2019-07-05 02:43:56 +09:00
Lennart Poettering b67f05dabf fsck: split out fsck return code definitions into a header file of its own
This way we can make use of it from other components too, such as
systemd-homed.
2019-07-05 02:31:12 +09:00
Lennart Poettering a709a3154d dissect: split out DM deferred remove into src/shared/dm-util.c
The function is generally useful, let's split it out so that we can make
use of it later on in systemd-homed.
2019-07-05 02:19:24 +09:00
Zbigniew Jędrzejewski-Szmek d7921114d7 udev: warn when we fail to parse udev.conf
This should be like any other parse error and a warning should be emitted.
Let's use log_syntax() so we get the CONFIG_FILE= set.
2019-07-04 10:36:19 +02:00
Zbigniew Jędrzejewski-Szmek 62c6bbbc09 tree-wide: use PROJECT_FILE instead of __FILE__
This replaces the internal uses of __FILE__ with the new macro.
2019-07-04 10:36:00 +02:00
Lennart Poettering ed9aa225e8 varlink: allow using varlink_wait() even with a server
This call can be useful even if a server object is declared.

(Originally this was not supported, because a server typically needs to
handle multiple connections, and thus a synchronous wait on one would
starve the others out. But in some cases it might make sense to have
varlink point-to-point connections — i.e. where the server only handles
a single connection ever — and there it makes sense to synchronously
wait on the one connection).
2019-07-04 12:35:52 +09:00
Lennart Poettering ca5e7694bd json: use JSON_VARIANT_ARRAY_FOREACH() where we can 2019-07-04 12:35:35 +09:00
Zbigniew Jędrzejewski-Szmek 71b7a6c47e shared/logs-show: indentation 2019-07-02 09:34:12 +02:00
Yu Watanabe 539bcc831b
Merge pull request #12903 from keszybz/condition-quoting
Condition quoting
2019-06-30 04:10:40 +09:00
Zbigniew Jędrzejewski-Szmek 910c6d0931 Treat kernel version condition as a list of quoted checks
Before only one comparison was allowed. Let's make this more flexible:
ConditionKernelVersion = ">=4.0" "<=4.5"

Fixes #12881.

This also fixes expressions like "ConditionKernelVersion=>" which would
evaluate as true.
2019-06-29 17:11:03 +02:00