Commit graph

37616 commits

Author SHA1 Message Date
Yu Watanabe ceb26cdbc2 sd-resolve: add sd_resolve_get{addr,info}_with_destroy_callback() and typesafe macros 2018-12-17 10:02:36 +09:00
Claudius Ellsel bd1c8360a4 Fixed small typo in 70-mouse.hwdb 2018-12-16 19:37:22 +01:00
NeilBrown 89f9752ea0 core/mount: minimize impact on mount storm.
If we create 2000 mounts (on a 1-CPU qemu VM) with
  mkdir -p /MNT/{1..2000}
  time for i in {1..2000}; do mount --bind /etc /MNT/$i ; done

it takes around 20 seconds to complete.  Much of this time is taken up
by systemd repeatedly processing /proc/self/mountinfo.
If I disable the processing, the time drops to about 4 seconds.

I have reports that on a larger system with multiple active user sessions, each
with it's own systemd, the impact can be higher.

One particular use-case where a large number of mounts can be expected in quick
succession is when the "clearcase" SCM starts up.

This patch modifies the handling up events from /proc/self/mountinfo so
that systemd backs off when a storm is detected.  Specifically the time to process
mountinfo is measured, and the process will not be repeated until 10 times
that duration has passed.  This ensures systemd won't use more than 10% of
real time processing mountinfo.

With this patch, my test above takes about 5 seconds.
2018-12-16 12:38:40 +01:00
Lennart Poettering 2d41e9b7a0
Merge pull request #11143 from keszybz/enable-symlink
Runtime mask symlink confusion fix
2018-12-16 12:37:07 +01:00
Filipe Brandenburger fc833520e4 Revert "lldp: add test coverage for sd_lldp_get_neighbors() with multiple neighbors"
This reverts commit dd102e4d0c.

That test case exposed a memory leak and breaks CI, so let's revert it until
the original issue is fixed, to prevent disruption of automated testing.
2018-12-15 20:58:39 +03:00
Filipe Brandenburger 2e14ea7d78
Merge pull request #11137 from poettering/bogus-id128
hostnamed: let's filter out some obviously bogus product UUIDs
2018-12-15 09:27:14 -08:00
Lennart Poettering ffd79164aa
Merge pull request #11140 from filbranden/lldpcmp1
Use ?: to chain comparison functions (for now, in lldp only)
2018-12-15 12:12:06 +01:00
Lennart Poettering 6839aa567c hostnamed: filter out all-zero and all-0xFF DMI ProductUUIDs
These UUIDs are considered as wildcard value for "unset" UUIDs
typically, and this even makes sense. Let's suppress them hence.
2018-12-15 12:06:44 +01:00
Lennart Poettering 670814387b sd-id128: add helpers to check fo all-0xFF ids 2018-12-15 12:06:44 +01:00
Lennart Poettering 463adf5710 sd-id128: slightly reorder function prototypes
Let's place the three calls for acquiring the IDs together, and the
calls for getting the app-specific ones separate from them.
2018-12-15 12:06:44 +01:00
Lennart Poettering 4783e5ad3d sd-128: base SD_ID128_MAKE() macro on existing SD_ID128_ARRAY() macro 2018-12-15 12:06:44 +01:00
Lennart Poettering 549b47247d fstab-generator: remove spurious newline 2018-12-15 12:06:44 +01:00
Alexey Bogdanenko d3e5af0440 mkosi: update libqrencode in Debian config
In Debian unstable package libqrencode-dev is version 4.0.2-1, and the
corresponding runtime library is provided by package libqrencode4.

This change fixes the following error when running journalctl:

    root@image:~# journalctl
    journalctl: error while loading shared libraries: libqrencode.so.4: cannot
    open shared object file: No such file or directory

This change also fixes the following boot failures in
systemd-journal-flush.service and systemd-journal-catalog-update.service:

    [FAILED] Failed to start Flush Journal to Persistent Storage.
    [FAILED] Failed to start Rebuild Journal Catalog.

See also #4949
2018-12-15 10:55:10 +01:00
Filipe Brandenburger dc6bf94d68 lldp: simplify compare_func, using ?: to chain comparisons
The ?: operator is very useful for chaining comparison functions
(strcmp, memcmp, CMP), since its behavior is to return the result
of the comparison function call if non-zero, or continue evaluating
the chain of comparison functions.

This simplifies the code in that using a temporary `r` variable
to store the function results is no longer necessary and the checks
for non-zero to return are no longer needed either, resulting in a
typical three-fold reduction to the number of lines in the code.

Introduce a new memcmp_nn() to compare two memory buffers in
lexicographic order, taking length in consideration.

Tested: $ ninja -C build/ test

All test cases pass. In particular, test_multiple_neighbors_sorted()
in test-lldp would catch regressions introduced by this commit.
2018-12-14 09:18:42 -08:00
Filipe Brandenburger dd102e4d0c lldp: add test coverage for sd_lldp_get_neighbors() with multiple neighbors
In particular, check that the order of the results is consistent.

This test coverage will be useful in order to refactor the compare_func
used while sorting the results.

Tested: ninja -C build/ test
2018-12-14 09:18:01 -08:00
Chris Down 09818a8893
Merge pull request #11160 from poettering/read-line-more-tests
some tests for read_line() EOL markers that coincide with EOF
2018-12-14 13:00:28 +00:00
Lennart Poettering 6baac700a8 tests: add a test that checks read_line() properly handles line endings at EOF
As requested here: https://github.com/systemd/systemd/pull/11129#discussion_r241588835
2018-12-14 12:57:32 +01:00
Lennart Poettering 31fd02f009 fileio: fail early if we can't return the number of bytes we read anymore in an int
This is mostly paranoia, but let's better be safer than sorry. This of
course means there's always an implicit limit to how much we can read at
a time of 2G. But that should be ample.
2018-12-14 12:56:12 +01:00
Zbigniew Jędrzejewski-Szmek 58d9d89b4b pid1: fix free of uninitialized pointer in unit_fail_if_noncanonical()
https://bugzilla.redhat.com/show_bug.cgi?id=1653068
2018-12-14 11:21:16 +01:00
Zbigniew Jędrzejewski-Szmek 0b57803630 man: add note about systemd-vconsole-setup.service and tty as input/output
Closes #10019.
2018-12-14 11:18:32 +01:00
Zbigniew Jędrzejewski-Szmek 3f9a0a522f tree-wide: s/time-out/timeout/g
From WordNet (r) 3.0 (2006) [wn]:

  time-out
      n 1: a brief suspension of play; "each team has two time-outs left"

From The Free On-line Dictionary of Computing (18 March 2015) [foldoc]:

  timeout

     A period of time after which an error condition is raised if
     some event has not occured.  A common example is sending a
     message.  If the receiver does not acknowledge the message
     within some preset timeout period, a transmission error is
     assumed to have occured.
2018-12-14 11:17:52 +01:00
Thomas Haller 1a35985264 in-addr-util: fix undefined result for in4_addr_netmask_to_prefixlen(<0.0.0.0>)
u32ctz() was undefined for zero due to __builtin_ctz() [1].
Explicitly check for zero to make the behavior defined.

Note that this issue only affected in4_addr_netmask_to_prefixlen()
which is the only caller.

It may seem slightly odd, to return 32 (bits) for utz(0). But that
is what in4_addr_netmask_to_prefixlen() needs, and it probably makes
the most sense here.

[1] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

Fixes: ba91431154
2018-12-14 11:15:36 +01:00
Bruce Zhang 0b1093018b add device hwdb for IdeaPad Miix510-12ISK
add ACCEL_MOUNT_MATRIX for IdeaPad Miix510-12ISK

multiple match expressions for Miix510 series

extend comments for miix510 series

Signed-off-by: Bruce Zhang <zttt183525594@gmail.com>

add device hwdb for IdeaPad Miix510-12ISK

Signed-off-by: Bruce Zhang <zttt183525594@gmail.com>
2018-12-14 09:16:36 +01:00
Lennart Poettering 838894b0c6 fileio: make read_line() handle various line endings correctly
This adds support for windows line endings.

More importantly though with this change a newline followed by EOF is
considered a single line end.
2018-12-14 09:12:17 +01:00
Zbigniew Jędrzejewski-Szmek 57db447ebf
Merge pull request #11147 from yuwata/bash-completion-machinectl
bash-completion: adds import-fs for machinectl and suggest more
2018-12-14 08:57:03 +01:00
Yu Watanabe f675a1f005 bash-completion: busctl: support --json and -j option 2018-12-14 08:55:38 +01:00
Zbigniew Jędrzejewski-Szmek 58493c6671
Merge pull request #11145 from yuwata/bash-completion-bootctl
bash-completion: bootctl: support set-default and set-oneshot
2018-12-14 08:54:44 +01:00
Yu Watanabe 5cd6711621 sd-netlink: set destroy_callback only if asynchronous call succeeds 2018-12-14 08:50:51 +01:00
Zbigniew Jędrzejewski-Szmek 40d70ca07c
Merge pull request #11152 from keszybz/meson-user-unit-symlinks
Fix future installation of user unit symlinks by meson
2018-12-14 08:31:50 +01:00
Lennart Poettering 9a6f746fb6 locale-util: prefix special glyph enum values with SPECIAL_GLYPH_
This has been irritating me for quite a while: let's prefix these enum
values with a common prefix, like we do for almost all other enums.

No change in behaviour, just some renaming.
2018-12-14 08:22:54 +01:00
Lennart Poettering fd0ec39d38
Merge pull request #11046 from keszybz/generator-mains
Macroify generators a bit more
2018-12-13 22:39:23 +01:00
Lennart Poettering ffd1a3f688 man: substantially update the docs regarding hooking sd-bus objects up with external event loops
Prompted by https://lists.freedesktop.org/archives/systemd-devel/2018-December/041817.html

This also drops all references to select() from our manpages. It's 2018
after all, people should use poll(), or ppoll() or epoll().
2018-12-13 22:33:47 +01:00
Michael Scherer 41fc3fab1c man: Use the proper option name in documentation 2018-12-13 20:30:58 +01:00
Zbigniew Jędrzejewski-Szmek 634cc94f47 units: replace symlinks in units/user/ by real files
We already *install* those as real files since de78fa9ba0.
Meson will start to copy symlinks as-is, so we would get dangling symlinks in
/usr/lib/systemd/user/.

I considered the layout in our sources to match the layout in the installation
filesystem (i.e. creating units/system/ and moving all files from units/ to
units/system/), but that seems overkill. By using normal files for both we get
some duplication, but those files change rarely, so it's not a big downside in
practice.

Fixes #9906.
2018-12-13 20:23:43 +01:00
Zbigniew Jędrzejewski-Szmek df13444339 units: drop units/user/busnames.target
It seems this was missed in 0ba8987337.
2018-12-13 20:23:43 +01:00
Yu Watanabe ff1cf894d2 bash-completion: nspawn: support recently added options 2018-12-14 03:18:33 +09:00
Yu Watanabe 223f58ba8d bash-completion: run: support recently added options 2018-12-14 03:18:33 +09:00
Yu Watanabe 2e68a49dc8 bash-completion: systemctl: use --output=help to show suggestions 2018-12-14 02:33:21 +09:00
Yu Watanabe fdc33681ae bash-completion: journalctl: use --output=help to show suggestions 2018-12-14 02:33:21 +09:00
Yu Watanabe d104486ab6 bash-completion: journalctl: drop deprecated --new-id128 option 2018-12-14 02:33:21 +09:00
Yu Watanabe 3b59e2cbed bash-completion: loginctl: suggest argument for --machine option 2018-12-14 02:22:40 +09:00
Yu Watanabe dfeebf55d9 bash-completion: loginctl: suggest argument for --output option 2018-12-14 02:18:35 +09:00
Yu Watanabe fad73e9deb bash-completion: machinectl: suggest arguments for --verify and --format
This also changes to use '--output=help' for suggesting arguments of
--output option.
2018-12-14 02:18:24 +09:00
Yu Watanabe 0e5bea97e9 bash-completion: machinectl: support import-fs 2018-12-14 01:52:48 +09:00
Yu Watanabe a73b2f4ab3 bash-completion: bootctl: support set-default and set-oneshot 2018-12-14 01:26:52 +09:00
Yu Watanabe ed0c5a6f89 bash-completion: bootctl: suggest argument for --path option 2018-12-14 01:26:25 +09:00
Yu Watanabe 8ed22786aa bash-completion: bootctl: add one missing option 2018-12-14 01:25:31 +09:00
Zbigniew Jędrzejewski-Szmek 421e3b45f0 NEWS: typos and wording adjustments 2018-12-13 11:10:07 +01:00
Zbigniew Jędrzejewski-Szmek 4b37c89f06 shared/install: ignore symlinks which have lower priority than the unit file
In #10583, a unit file lives in ~/.config/systemd/user, and
'systemctl --runtime --user mask' is used to create a symlink in /run.
This symlink has lower priority than the config file, so
'systemctl --user' will happily load the unit file, and does't care about
the symlink at all.

But when asked if the unit is enabled, we'd look for all symlinks, find the
symlink in the runtime directory, and report that the unit is runtime-enabled.
In this particular case the fact that the symlink points at /dev/null, creates
additional confusion, but it doesn't really matter: *any* symlink (or regular
file) that is lower in the priority order is "covered" by the unit fragment,
and should be ignored.

Fixes #10583.
2018-12-13 10:46:27 +01:00
Zbigniew Jędrzejewski-Szmek 3e8d06d951 shared/install: add some more debugging info
Just to make it easier to understand what is going on.
2018-12-13 08:40:38 +01:00