diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-11-06 19:41:58 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-11-06 19:41:58 +0100 |
commit | 11d5eec2cb75327b3d3f5360010d6afc3550a8e6 (patch) | |
tree | 9b5feeb365a08717e3343686cdd44eb564b80dd5 /udev/lib/libudev-queue.c | |
parent | 78230c0dbedbb9273bf2abde8c48db1e8be952f8 (diff) |
udevadm: settle - exit if udevd exits
Diffstat (limited to 'udev/lib/libudev-queue.c')
-rw-r--r-- | udev/lib/libudev-queue.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 28d877749d..51878dab67 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -133,6 +133,20 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) return seqnum; } +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +{ + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + + if (udev_queue == NULL) + return 0; + util_strlcpy(filename, udev_get_dev_path(udev_queue->udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + if (stat(filename, &statbuf) == 0) + return 1; + return 0; +} + int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { char queuename[UTIL_PATH_SIZE]; @@ -152,7 +166,10 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) dbg(udev_queue->udev, "queue is empty\n"); return 1; } - udev_queue_get_udev_seqnum(udev_queue); + /* update udev seqnum, and check if udev is still running */ + if (udev_queue_get_udev_seqnum(udev_queue) == 0) + if (!udev_queue_get_udev_is_active(udev_queue)) + return 1; if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { dbg(udev_queue->udev, "queue is empty\n"); return 1; |