summaryrefslogtreecommitdiff
path: root/src/udev/udevadm-control.c
Commit message (Collapse)AuthorAgeFilesLines
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* Revert "udev: do not kill "udevadm control" process in the same cgroup"Yu Watanabe2022-03-171-5/+0
| | | | | | This reverts commit ccadf9ac0d6d206767294b3f96f41eb42b48d1b0. The fix is not insufficient. See #22686.
* udev: do not kill "udevadm control" process in the same cgroupYu Watanabe2021-12-181-0/+5
| | | | Fixes #16867.
* udev: also rename struct udev_ctrl -> UdevCtrlYu Watanabe2021-08-101-1/+1
|
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-2/+2
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: GPL-2.0+ -> GPL-2.0-or-laterYu Watanabe2020-11-091-1/+1
|
* udevadm: rename option '--log-priority' into '--log-level'Franck Bui2020-09-221-4/+5
| | | | | | Let's be consistent with systemctl(1). '--log-priority' i still kept only for backward compatibility.
* udevadm: drop pointless must_be_root() checksZbigniew Jędrzejewski-Szmek2019-05-081-4/+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.
* udev-ctrl: split out logic of waiting for reply to udev_ctrl_wait()Yu Watanabe2019-02-201-17/+37
| | | | | This makes `udevadm control` can send multiple commands in one connection.
* udevadm: print error if the commands failZbigniew Jędrzejewski-Szmek2019-02-201-7/+7
| | | | We'd exit with an error but no output. Print the error in the usual fashion.
* udev-ctrl: make udev_ctrl_new() return negative errno on failureYu Watanabe2019-02-201-3/+3
|
* udevadm: add --ping option to 'control' commandYu Watanabe2019-01-181-12/+23
| | | | This exposes `udev_ctrl_send_ping()`.
* udev: use usec_t for timeout in udev_ctrl_send_*()Yu Watanabe2019-01-131-12/+4
|
* udevadm: use SYNTHETIC_ERRNO() macroYu Watanabe2019-01-131-4/+3
|
* udevadm: improve error message when no option specified for 'control' commandYu Watanabe2019-01-131-9/+6
| | | | Also drop redundant block, use SYNTHETIC_ERRNO(), and add log_oom().
* udevadm: refuse to run trigger, control, settle and monitor commands in chrootYu Watanabe2019-01-081-0/+6
| | | | Closes #11333.
* udev: drop util_log_priority() and use log_level_from_string()Yu Watanabe2018-11-121-9/+6
| | | | | | The function util_log_priority() is almost same as log_level_from_string(). The difference between them is only that util_log_priority() accepts such that '3 hogehoge'.
* udev-ctrl: move prototypes of udev_ctrl_*() to udev-ctrl.hYu Watanabe2018-10-111-1/+3
|
* udevadm: show only version number for '--version' optionYu Watanabe2018-09-211-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.
* udevadm-control: modernize code a bitYu Watanabe2018-09-101-64/+60
|
* udevadm: use dispatch_verb() and drop udevadm_cmd structYu Watanabe2018-09-101-7/+2
|
* udev: drop unused udev structYu Watanabe2018-09-101-2/+2
|
* udev: move udev cleanup functions from udev-util.h to udev.hYu Watanabe2018-08-231-1/+0
|
* tree-wide: drop empty lines in commentsYu Watanabe2018-07-231-1/+0
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-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
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* coccinelle: make use of DIV_ROUND_UP() wherever appropriateLennart Poettering2018-03-201-4/+3
| | | | Let's use our macros where we can
* log: minimize includes in log.hLennart Poettering2018-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* tree-wide: unify logging of "Must be root" messageLennart Poettering2017-12-111-3/+1
| | | | | Let's unify this in one call, generalizing must_be_root() from bootctl.c.
* udevadm: getopt() and help message cleanupYu Watanabe2017-12-051-3/+9
| | | | | | | | | 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.
* udevadm-control: list all short options in help textMarcus Folkesson2017-12-031-1/+1
| | | | Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
* Add SPDX license identifiers to source files under the GPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
|
* udevadm: use parse_sec instead of atoi for timeout option (#4331)Stefan Schweter2016-10-111-10/+19
| | | log_error method is used instead of fprintf
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* udev: add emacs header lineZbigniew Jędrzejewski-Szmek2015-12-071-0/+2
| | | | | Otherwise emacs wants to use 2-space indentation and other attrocities.
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-3/+3
| | | | Sort the includes accoding to the new coding style.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-5/+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.
* udevadm,..: make --help output of udev tools more like the output of the ↵Lennart Poettering2015-01-051-11/+14
| | | | various other tools
* udev: place opening { at the same line as the function declarationKay Sievers2014-07-291-4/+2
|
* udevadm: modernizationZbigniew Jędrzejewski-Szmek2013-12-181-6/+5
|
* udevadm,scsi_id: add short options to help strings and to the man pageZbigniew Jędrzejewski-Szmek2013-12-181-33/+26
| | | | Also clean things up a bit here and there.
* use the same email address everywhereKay Sievers2012-11-121-1/+1
|
* move imported udev into placeKay Sievers2012-04-041-0/+175