summaryrefslogtreecommitdiff
path: root/src/udev/udevadm-trigger.c
AgeCommit message (Collapse)AuthorFilesLines
2019-11-18udevadm: ignore EROFS and return earlierYu Watanabe1-2/+5
Fixes #14060.
2019-10-02udevadm trigger: do not propagate EACCES and ENODEVYu Watanabe1-2/+4
Inside container, writing file returns EACCESS. Moreover, some devices return ENODEV rather than EACCES. So, let's also ignore these two error causes. Closes #13652.
2019-06-29udevadm: support special value 'help' for --action optionYu Watanabe1-1/+5
2019-06-05udevadm trigger: log errors and return first failureZbigniew Jędrzejewski-Szmek1-3/+6
When udevadm trigger is called, the list of devices to trigger is always generated through enumeration, and devices can come and go, so we should not treat -ENOENT as a failure. But other types of failure should be logged. It seems they were logged until baa30fbc2c04b23209d0b8fb3c86cd15ef9ea81a. Also, return the first error. (I'm not sure if there are other failure modes which we want to ignore. If they are, they'll need to be whitelisted like -ENOENT.).
2019-05-08udevadm: drop pointless must_be_root() checksZbigniew Jędrzejewski-Szmek1-6/+0
Checking if we are root on the client side is generally pointless, since the privileged operation will fail anyway and we can than log what precisly went wrong. A check like this makes sense only if: - we need to do some expensive unprivileged operation before attempting the privileged operation, and the check allows us avoid wasting resources. - the privileged operation would fail but in an unclear way. Neither of those cases applies here. This fixes calls like 'udevadm control -h' as unprivileged user.
2019-03-12udev: fix memleak in 'udevadm trigger --settle'Yu Watanabe1-1/+3
Fixes #11966.
2019-03-07udevadm trigger: make --action option support all possible actionsYu Watanabe1-4/+4
This also make udevadm abort operations if invalid action is specified.
2019-02-20udev-ctrl: split out logic of waiting for reply to udev_ctrl_wait()Yu Watanabe1-1/+5
This makes `udevadm control` can send multiple commands in one connection.
2019-02-20udev-ctrl: make udev_ctrl_new() return negative errno on failureYu Watanabe1-3/+3
2019-01-23udevadm: trigger: support multiple argumentsYu Watanabe1-3/+3
Closes #6098.
2019-01-18udevadm: add --wait-daemon option to 'trigger' commandYu Watanabe1-1/+36
2019-01-13udevadm: use SYNTHETIC_ERRNO() macroYu Watanabe1-8/+4
2019-01-08udevadm: refuse to run trigger, control, settle and monitor commands in chrootYu Watanabe1-0/+6
Closes #11333.
2018-11-30tree-wide: rename path_join_many() to path_join()Zbigniew Jędrzejewski-Szmek1-1/+1
$ git grep -e path_join_many -l|xargs sed -r -i 's/path_join_many/path_join/g' The two test functions are merged into one.
2018-11-30tree-wide: replace path_join with path_join_manyZbigniew Jędrzejewski-Szmek1-1/+1
2018-11-10sd-device: drop priority and description from ↵Yu Watanabe1-2/+2
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-06udevadm: use write_string_file() helper functionYu Watanabe1-6/+5
2018-10-17udevadm-trigger: use sd_event_loop()Yu Watanabe1-60/+43
2018-10-17udevadm-trigger: modernize code a bitYu Watanabe1-34/+48
2018-10-17udevadm-trigger: replace udev_monitor by sd_device_monitorYu Watanabe1-19/+19
2018-10-17udevadm-info,trigger: replace udev_device by sd_deviceYu Watanabe1-59/+77
2018-09-21udevadm: show only version number for '--version' optionYu Watanabe1-1/+1
This effectively reverts 2bc54be485def3d1697a00209ff73ae21aa7f268 and relevant changes in #9920, as it is used to determine the version of udev, e.g., dracut. Fixes dracutdevs/dracut#468.
2018-09-10udevadm-trigger: make trigger_main() returns negative value on errorYu Watanabe1-82/+51
2018-09-10udevadm: use dispatch_verb() and drop udevadm_cmd structYu Watanabe1-7/+2
2018-09-10udev: drop unused udev structYu Watanabe1-6/+6
2018-08-23udev: move udev cleanup functions from udev-util.h to udev.hYu Watanabe1-1/+0
2018-07-23tree-wide: drop empty lines in commentsYu Watanabe1-3/+0
2018-06-20tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek1-1/+0
Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
2018-06-14Drop more license boilerplateZbigniew Jędrzejewski-Szmek1-12/+0
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \ xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms' For some reason they were missed previously. All those files seem to have proper SDPX tags.
2018-06-14tree-wide: use proper unicode © instead of (C) where we canLennart Poettering1-1/+1
Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
2018-04-25tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering1-6/+6
This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
2018-02-15udevadm: fix fd leak on oomZbigniew Jędrzejewski-Szmek1-2/+3
Unlikely, but let's be correct. CID #1386003.
2018-02-09udevadm: check for oom and other style fixesZbigniew Jędrzejewski-Szmek1-11/+19
2018-02-09udevadm: allow trigger command to be synchronousMao1-8/+89
There are cases that we want to trigger and settle only specific commands. For example, let's say at boot time we want to make sure all the graphics devices are working correctly because it's critical for booting, but not the USB subsystem (we'll trigger USB events later). So we do: udevadm trigger --action="add" --subsystem-match="graphics" udevadm settle However, we cannot block the kernel from emitting kernel events from discovering USB devices. So if any of the USB kernel event was emitted before the settle command, the settle command would still wait for the entire queue to complete. And if the USB event takes a long time to be processed, the system slows down. The new `settle` option allows the `trigger` command to wait for only the triggered events, and effectively solves this problem.
2017-12-05udevadm: getopt() and help message cleanupYu Watanabe1-3/+7
This adds missing options, mainly '--version' in getopt(), removes an unused option from getopt(). Also, this adds a deprecate message in `udevadm hwdb`, and cleanups help messages. Follow-up for 65eb4378c3e1de25383d8cd606909e64c71edc80.
2017-11-19Add SPDX license identifiers to source files under the GPLZbigniew Jędrzejewski-Szmek1-0/+1
2017-10-04udevadm,basic: replace nulstr_contains with STR_IN_SET (#6965)Zbigniew Jędrzejewski-Szmek1-1/+1
STR_IN_SET is a newer approach which is easier to write and read, and which seems to result in space savings too: before: 4949848 build/src/shared/libsystemd-shared-234.so 350704 build/systemctl 4967184 build/systemd 826216 build/udevadm after: 4949848 build/src/shared/libsystemd-shared-234.so 350704 build/systemctl 4966888 build/systemd 826168 build/udevadm
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack1-2/+0
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2015-12-07udev: add emacs header lineZbigniew Jędrzejewski-Szmek1-0/+2
Otherwise emacs wants to use 2-space indentation and other attrocities.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering1-5/+6
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-06-23udevadm: trigger - check return valuesTom Gundersen1-11/+51
Fixes CID#1296243.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen1-7/+0
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-01-05udevadm,..: make --help output of udev tools more like the output of the ↵Lennart Poettering1-18/+21
various other tools
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt1-1/+1
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-25udevadm trigger: allow matching by device nameZbigniew Jędrzejewski-Szmek1-17/+43
This makes udevadm trigger mirror udevadm info, except that multiple device names can be specified. Instructions in 60-keyboard.hwdb should now actually work. udevadm(8) is updated, but it could use a bit more polishing. https://bugs.freedesktop.org/show_bug.cgi?id=82311
2014-11-25udevadm: split out find_device helperZbigniew Jędrzejewski-Szmek1-12/+6
The idea is to unify the way that devices can be specified.
2014-08-11udev: never bypass our own logging framework and call vsyslog() directly ↵Lennart Poettering1-1/+0
from udev tools
2014-07-29udev: place opening { at the same line as the function declarationKay Sievers1-6/+3
2014-02-13everywhere: always use O_CLOEXEC where it makes senseLennart Poettering1-1/+1
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering1-4/+4
including it in the log strings