Commit Graph

1693 Commits

Author SHA1 Message Date
Yu Watanabe 916707cca5 sd-device: do not call device_monitor_enable_receiving() for passed fd from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_monitor_enable_receiving()` (now it is a wrapper
of `device_monitor_enable_receiving`) was not called.
Let's preserve the original logic.

Fixes #10754.
2018-11-25 20:14:17 +09:00
Yu Watanabe f1d7b7874e sd-device: check whether filter is updated or not in sd_device_monitor_filter_update() 2018-11-25 15:26:43 +09:00
Yu Watanabe 5cee547a94 sd-device: update log message 2018-11-25 14:06:56 +09:00
Yu Watanabe 779c923467 sd-device: fix return value on error path 2018-11-25 14:06:27 +09:00
Zbigniew Jędrzejewski-Szmek e5e0a79623 pid1,sd-device: use PATH_STARTSWITH_SET more 2018-11-23 13:37:47 +01:00
Yu Watanabe a5a59a2447 test: add more tests for subsystem filter 2018-11-23 06:46:29 +09:00
Yu Watanabe 65fe9c319f sd-device-monitor: fix subsystem filter
This fixes a bug introduced by 759d9f3f8d.

Fixes #10882.
2018-11-23 02:49:28 +09:00
Zbigniew Jędrzejewski-Szmek 886cf317c4 coccinelle: also mark previous synthetic errnos as such 2018-11-22 10:54:38 +01:00
Zbigniew Jędrzejewski-Szmek baaa35ad70 coccinelle: make use of SYNTHETIC_ERRNO
Ideally, coccinelle would strip unnecessary braces too. But I do not see any
option in coccinelle for this, so instead, I edited the patch text using
search&replace to remove the braces. Unfortunately this is not fully automatic,
in particular it didn't deal well with if-else-if-else blocks and ifdefs, so
there is an increased likelikehood be some bugs in such spots.

I also removed part of the patch that coccinelle generated for udev, where we
returns -1 for failure. This should be fixed independently.
2018-11-22 10:54:38 +01:00
Lennart Poettering 012c2f761b tree-wide: use __ prefixed gcc attributes (#10843)
As suggest here:

https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

    "You may optionally specify attribute names with ‘__’ preceding and
    following the name. This allows you to use them in header files without
    being concerned about a possible macro of the same name. For example,
    you may use the attribute name __noreturn__ instead of noreturn. "
2018-11-20 12:34:08 +09:00
Yu Watanabe af18705f8e test: also tests enumerating subsystems 2018-11-17 18:18:22 +01: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 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
Zbigniew Jędrzejewski-Szmek 08c1eb0e30 sd-event: make sd_event_source_get_enabled return more info 2018-11-16 09:03:41 +01:00
Zbigniew Jędrzejewski-Szmek 7d92a1a490 sd-event: do not use assert_return for something that is not an error
It's totally OK for description to be unset, so let's not log about this
even at debug level.
2018-11-16 09:00:33 +01:00
Zbigniew Jędrzejewski-Szmek cd5a29ce98
Merge pull request #10742 from poettering/c-utf8
default to C.UTF-8 locale, and many improvements to env var file parsing/kernel cmdline parsing
2018-11-15 12:47:17 +01:00
Lennart Poettering 042cad5737
Merge pull request #10753 from keszybz/pager-no-interrupt
Add mode in journalctl where ^C is handled by the pager
2018-11-14 20:09:39 +01:00
Lennart Poettering 13df9c398d fileio: automatically add NULL sentinel to parse_env_file()
Let's modernize things a bit.
2018-11-14 17:01:55 +01:00
Lennart Poettering aa8fbc74e3 fileio: drop "newline" parameter for env file parsers
Now that we don't (mis-)use the env file parser to parse kernel command
lines there's no need anymore to override the used newline character
set. Let's hence drop the argument and just "\n\r" always. This nicely
simplifies our code.
2018-11-14 17:01:54 +01:00
Zbigniew Jędrzejewski-Szmek fde32028a4 Move LONG_LINE_MAX definition to fileio.h
All users of the macro (except for one, in serialize.c), use the macro in
connection with read_line(), so they must include fileio.h.  Let's not play
libc games and require multiple header file to be included for the most common
use of a function.

The removal of def.h includes is not exact. I mostly went over the commits that
switch over to use read_line() and add def.h at the same time and reverted the
addition of def.h in those files.
2018-11-14 16:25:32 +01:00
Lennart Poettering 0a885dd055 sd-bus: port over to namespace_fork()
This is pretty similar code, let's replace it with the generic
namespace_fork() implementation.
2018-11-13 10:49:18 +01:00
Yu Watanabe e559eca1b6 sd-bus: use SD_BUS_ERROR_NULL macro
Follow-up for e8f280bd0a.
2018-11-12 16:32:10 +09:00
Lennart Poettering 5fb0720ebb
Merge pull request #10728 from keszybz/four-unrelated-cleanups
Four unrelated cleanups
2018-11-11 21:16:14 +01:00
Yu Watanabe deb2b7348e sd-device: drop priority and description from sd_device_monitor_attach_event() and sd_device_monitor_start()
Now we have sd_device_monitor_get_event_soruce(). So, it is not
necessary to include these parameters in the functions for sd_device_monitor.
2018-11-10 22:53:00 +09:00
Yu Watanabe bf7712b63e sd-device: add sd_device_monitor_get_event_source() 2018-11-10 22:53:00 +09:00
Yu Watanabe 8d578a2e73 sd-device: fix possible use of uninitialized value 2018-11-10 11:59:32 +01:00
Zbigniew Jędrzejewski-Szmek e8f280bd0a sd_bus: use structured intialization in one more place 2018-11-09 21:40:21 +01:00
Lennart Poettering c4e48030cf sd-bus: make "close+flush-on-exit" optional when using sd-event with sd-bus
This adds a new pair of API calls sd_bus_set_close_on_exit() and
sd_bus_get_close_on_exit(). They control whether an sd_bus object
attached to a an sd-event loop shall automatically be flushed/closed
when the event loop goes down. Usually that's a good thing, except for
very few cases where the bus connection is longer living than the event
loop it is attached on. Specifically, this is the case for nspawn, where
we run the event loop only while the container is up, but afterwards
still want to be able to use the bus connection.
2018-11-09 17:08:59 +01:00
Lennart Poettering cc83d5197c random-util: optionally allow randomness to be generated via RDRAND
We only use this when we don't require the best randomness. The primary
usecase for this is UUID generation, as this means we don't drain
randomness from the kernel pool for them. Since UUIDs are usually not
secrets RDRAND should be goot enough for them to avoid real-life
collisions.
2018-11-08 09:44:27 +01:00
Lennart Poettering 94d457e8d9 random-util: change high_quality_required bool parameter into a flags parameter
No change in behaviour, just some refactoring.
2018-11-08 09:44:27 +01:00
Lennart Poettering 3335dc2d75 random-util: rename acquire_random_bytes() → genuine_random_bytes()
It's more descriptive, since we also have a function random_bytes()
which sounds very similar.

Also rename pseudorandom_bytes() to pseudo_random_bytes(). This way the
two functions are nicely systematic, one returning genuine random bytes
and the other pseudo random ones.
2018-11-08 09:44:27 +01:00
Zbigniew Jędrzejewski-Szmek e44c5a3ba6
Merge pull request #10594 from poettering/env-reload-fix
change handling of environment block of PID1's manager object
2018-11-07 12:49:13 +01:00
Lennart Poettering 9edcbc4f44
Merge pull request #10602 from yuwata/sd-device-logs
update log messages
2018-11-06 19:33:51 +03:00
Lennart Poettering b992109b3e
Merge pull request #10633 from yuwata/sd-resolve-destroy
Another solution to fix wireguard issues
2018-11-06 19:30:59 +03:00
Yu Watanabe 7cadbe09e9 sd-device: use write_string_file() helper to write sysattr 2018-11-06 21:24:03 +09:00
Yu Watanabe a5db6debcd test: check returned value of sd_device_get_usec_since_initialized() 2018-11-06 15:45:22 +09:00
Yu Watanabe 754d6c26b4 test: show is_initialized flag in log message of test-sd-device
And drop devpath, as it is redundant for most cases.
2018-11-06 15:45:22 +09:00
Yu Watanabe ecbe9873a9 test: show name of testing functions in test-sd-device 2018-11-06 15:45:22 +09:00
Yu Watanabe c7d54daef9 sd-device: normalize debug messages 2018-11-06 15:45:22 +09:00
Yu Watanabe 38d1555d7c sd-device: drop subsystem from log_device_*()
The sd_device object always has syspath and sysname, but subsytem may not.
Also, it may take some costs to get subsystem.
So, let's drop subsystem from logs.
2018-11-06 15:45:22 +09:00
Yu Watanabe 2382c9367b sd-event: add sd_event_source_{get,set}_floating() 2018-11-05 13:19:02 +09:00
Yu Watanabe b3ae7237c6 sd-resolve: introduce sd_resolve_query_{get,set}_floating() 2018-11-05 13:19:02 +09:00
Yu Watanabe a8319dea1d sd-resolve: introduce sd_resolve_query_{get,set}_destroy_callback() 2018-11-05 13:19:02 +09:00
Tobias Jungel 99f68ef02d networkd: add missing bonding options (#10542)
Add support for bonding options system prio, port key and actor system mac.

These options exist in the linux kernel since 4.2
(torvalds/linux@171a42c38c)

Details:
https://www.kernel.org/doc/Documentation/networking/bonding.txt
2018-11-02 10:31:20 +09:00
Lennart Poettering bea1a01310 strv: wrap strv_new() in a macro so that NULL sentinel is implicit 2018-10-31 18:00:52 +01:00
Yu Watanabe 5a937ea2f6 sd-device: make sd_device_get_is_initialized() returns is_initialized by return value 2018-10-29 17:33:33 +09:00
Yu Watanabe 78ffb476f2 sd-device: make several sd_device_get_*() accepts NULL pointer for buffer of returned value
When only the existence of the value are important, then we can set
NULL now.
2018-10-29 17:18:00 +09:00