summaryrefslogtreecommitdiff
path: root/src/udev/udev-ctrl.c
Commit message (Collapse)AuthorAgeFilesLines
* udev,sd-device: use CMSG_FIND_DATA() moreLennart Poettering2023-04-131-6/+2
|
* tree-wide: use -EBADF moreYu Watanabe2022-12-211-3/+3
|
* 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.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-3/+1
|
* tree-wide: replace AF_LOCAL with AF_UNIXYu Watanabe2022-05-141-1/+1
|
* udev: do not use sd_event_source_disable_unref() at more placesYu Watanabe2022-03-311-2/+2
| | | | | | Fixes a bug introduced by 9612da361a825d70a9fd392f3ee5a53bf8896887. Follow-up for f777e745a7966ea52ef29f9e4edfdd16874cfe86.
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-1/+1
| | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* udev: use sd_event_source_disable_unref()Yu Watanabe2022-03-241-3/+3
| | | | | This should not change any behavior, as the event sources are not shared. Just for safety.
* Revert "udev: do not kill "udevadm control" process in the same cgroup"Yu Watanabe2022-03-171-10/+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/+10
| | | | Fixes #16867.
* udev-ctrl: make udev_ctrl_send() accept integer and string through a single ↵Yu Watanabe2021-12-181-6/+7
| | | | argument
* udev: do not remove control socket on exitYu Watanabe2021-09-011-20/+2
| | | | | | | | | As we usually do, remove old unix socket before bind. Note that systemd-udevd-control.socket has `RemoveOnStop=yes`. So, it is not necessary to be removed when the service exits. Replaces #20584 and #20588.
* udev: also rename struct udev_ctrl -> UdevCtrlYu Watanabe2021-08-101-26/+26
|
* tree-wide: reset the cleaned-up variable in cleanup functionsZbigniew Jędrzejewski-Szmek2021-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the cleanup function returns the appropriate type, use that to reset the variable. For other functions (usually the foreign ones which return void), add an explicit value to reset to. This causes a bit of code churn, but I think it might be worth it. In a following patch static destructors will be called from a fuzzer, and this change allows them to be called multiple times. But I think such a change might help with detecting unitialized code reuse too. We hit various bugs like this, and things are more obvious when a pointer has been set to NULL. I was worried whether this change increases text size, but it doesn't seem to: -Dbuildtype=debug: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494520 Feb 16 15:06 build/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494576 Feb 16 15:10 build/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494640 Feb 16 15:15 build/systemd* -Dbuildtype=release: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:09 build-rawhide/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:10 build-rawhide/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:16 build-rawhide/systemd* I would expect that the compiler would be able to elide the setting of a variable if the variable is never used again. And this seems to be the case: in optimized builds there is no change in size whatsoever. And the change in size in unoptimized build is negligible. Something strange is happening with size of libsystemd: it's bigger in optimized builds. Something to figure out, but unrelated to this patch.
* tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-0/+1
| | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* udev: drop license boilerplateYu Watanabe2020-12-161-9/+1
|
* udev: drop meaningless size optimizationYu Watanabe2020-12-101-4/+4
| | | | | These objects are not allocated multiple times simultaneously per single process.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* udev-ctrl: drop workaround for old kernel bugDavid Tardon2020-10-141-9/+0
| | | | | | It's been 7 years. That should be long enough :-) This reverts commit b97caef538ae37bd2dc04fc15b448c12a2c9422b.
* udev: make use of NULL callback in IO handlersLennart Poettering2020-10-071-5/+1
|
* tree-wide: make use of new relative time events in sd-event.hLennart Poettering2020-07-281-3/+4
|
* tree-wide: make sure our control buffers are properly alignedLennart Poettering2020-05-071-3/+3
| | | | | | | | | | | | | We always need to make them unions with a "struct cmsghdr" in them, so that things properly aligned. Otherwise we might end up at an unaligned address and the counting goes all wrong, possibly making the kernel refuse our buffers. Also, let's make sure we initialize the control buffers to zero when sending, but leave them uninitialized when reading. Both the alignment and the initialization thing is mentioned in the cmsg(3) man page.
* tree-wide: use recvmsg_safe() at various placesLennart Poettering2020-04-231-6/+4
| | | | | | | | | | | | | | | | | Let's be extra careful whenever we return from recvmsg() and see MSG_CTRUNC set. This generally means we ran into a programming error, as we didn't size the control buffer large enough. It's an error condition we should at least log about, or propagate up. Hence do that. This is particularly important when receiving fds, since for those the control data can be of any size. In particular on stream sockets that's nasty, because if we miss an fd because of control data truncation we cannot recover, we might not even realize that we are one off. (Also, when failing early, if there's any chance the socket might be AF_UNIX let's close all received fds, all the time. We got this right most of the time, but there were a few cases missing. God, UNIX is hard to use)
* tree-wide: drop socket.h when socket-util.h is includedYu Watanabe2019-11-041-1/+0
|
* udevadm: use usec_add()Yu Watanabe2019-09-181-5/+4
| | | | Also fixes description of event source.
* udevadm: missing initialization of descriptorYu Watanabe2019-09-181-0/+1
|
* udev: fix wrong event source to set descriptionYu Watanabe2019-06-291-1/+1
|
* tree-wide: port users over to use new ERRNO_IS_ACCEPT_AGAIN() callLennart Poettering2019-04-101-3/+5
|
* udev-ctrl: split out logic of waiting for reply to udev_ctrl_wait()Yu Watanabe2019-02-201-43/+55
| | | | | This makes `udevadm control` can send multiple commands in one connection.
* udev-ctrl: use sd_event and introduce udev_ctrl_start()Yu Watanabe2019-02-201-208/+172
| | | | | Now the new callback function get enum udev_ctrl_msg_type. So, this commit also drops udev_ctrl_connection and udev_ctrl_msg.
* udev-ctrl: refactor udev_ctrl_enable_receiving()Yu Watanabe2019-02-201-15/+18
|
* udev-ctrl: make udev_ctrl_new() return negative errno on failureYu Watanabe2019-02-201-18/+18
|
* udev: use usec_t for timeout in udev_ctrl_send_*()Yu Watanabe2019-01-131-10/+10
|
* udev: modernize ctrl_send and use PROJECT_VERSIONZbigniew Jędrzejewski-Szmek2018-12-211-31/+19
| | | | | | | | | | | | | | PROJECT_VERSION is used in preparation for future changes. Let's simplify the code by using structured initialization. If the string written to .version ever became to long, the compiler will truncate it and tell us: ../src/udev/udev-ctrl.c: In function ‘ctrl_send’: ../src/udev/udev-ctrl.c:221:28: warning: initializer-string for array of chars is too long .version = "udev-" STRINGIFY(R_VERSION), ^~~~~~~ ../src/udev/udev-ctrl.c:221:28: note: (near initialization for ‘ctrl_msg_wire.version’) No functional change.
* util: drop missing.h from socket-util.hYu Watanabe2018-12-061-0/+1
|
* tree-wide: use IOVEC_MAKE() at many placesLennart Poettering2018-11-271-2/+2
|
* udev: drop duplicate whitespacesYu Watanabe2018-11-261-2/+2
|
* udev-ctrl: update log messagesYu Watanabe2018-11-261-15/+15
|
* udev-ctrl: fix coding style isuuesYu Watanabe2018-11-261-7/+7
|
* tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2018-10-191-1/+1
|
* tree-wide: introduce setsockopt_int() helper and make use of it everywhereLennart Poettering2018-10-181-4/+4
| | | | | | As suggested by @heftig: https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
* udev: use safe_close() where we canLennart Poettering2018-10-151-2/+1
|
* tree-wide: add a single version of "static const int one = 1"Lennart Poettering2018-10-151-4/+2
| | | | | | | | | | All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
* tree-wide: use structured initialization for sockaddr_unLennart Poettering2018-10-151-2/+5
|
* tree-wide: use sockaddr_un_unlink() whereever appropriateLennart Poettering2018-10-151-2/+2
| | | | Let's port everything over.
* udev-ctrl: move prototypes of udev_ctrl_*() to udev-ctrl.hYu Watanabe2018-10-111-1/+2
|
* udev-ctrl: use DEFINE_TRIVIAL_REF_FUNC() macro or friendsYu Watanabe2018-09-101-42/+25
|
* udev: drop unused udev structYu Watanabe2018-09-101-9/+3
|
* 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