summaryrefslogtreecommitdiffstats
path: root/src/libudev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-07-18 08:55:12 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-07-31 16:23:00 +0200
commit9daec33938676c7439eecefe4c29d0891dd386ba (patch)
treed6ada024b7b567c46c14d11c820e6cd55b103897 /src/libudev
parentMerge pull request #28596 from keszybz/doc-updates (diff)
downloadsystemd-9daec33938676c7439eecefe4c29d0891dd386ba.tar.xz
systemd-9daec33938676c7439eecefe4c29d0891dd386ba.zip
udev-util: drop udev_queue_init() from shared
It is only used in libudev, let's move it.
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-queue.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index 7c5bb5500c..0af99e5481 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -192,18 +192,21 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu
* Returns: a file descriptor to watch for a queue to become empty.
*/
_public_ int udev_queue_get_fd(struct udev_queue *udev_queue) {
- int r;
+ _cleanup_close_ int fd = -EBADF;
assert_return(udev_queue, -EINVAL);
if (udev_queue->fd >= 0)
return udev_queue->fd;
- r = udev_queue_init();
- if (r < 0)
- return r;
+ fd = inotify_init1(IN_CLOEXEC);
+ if (fd < 0)
+ return -errno;
+
+ if (inotify_add_watch(fd, "/run/udev" , IN_DELETE) < 0)
+ return -errno;
- return udev_queue->fd = r;
+ return udev_queue->fd = TAKE_FD(fd);
}
/**