[systemd-devel] [PATCH 2/2] udev: Allow detection of udevadm settle timeout
Nir Soffer
nirsof at gmail.com
Wed Apr 8 12:40:48 PDT 2015
When udevadm settle times out, it exits with exit code 1. This make it
impossible for users to detect a timeout and handle real errors. Now we
use exit code 3 on timeouts.
---
src/udev/udevadm-settle.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index 715d2e7..8f9ae81 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -29,6 +29,8 @@
#include "udev.h"
#include "util.h"
+#define EXIT_TIMEOUT 3
+
static void help(void) {
printf("%s settle OPTIONS\n\n"
"Wait for pending udev events.\n\n"
@@ -142,8 +144,10 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
break;
}
- if (now(CLOCK_MONOTONIC) >= deadline)
+ if (now(CLOCK_MONOTONIC) >= deadline) {
+ rc = EXIT_TIMEOUT;
break;
+ }
/* wake up when queue is empty */
if (poll(pfd, 1, MSEC_PER_SEC) > 0 && pfd[0].revents & POLLIN)
--
1.9.3
More information about the systemd-devel
mailing list