[systemd-devel] [PATCH 2/2] udev: Allow detection of udevadm settle timeout
David Herrmann
dh.herrmann at gmail.com
Sat Apr 11 03:50:57 PDT 2015
Hi
On Wed, Apr 8, 2015 at 9:40 PM, Nir Soffer <nirsof at gmail.com> wrote:
> 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.
What's the use-case for this?
Thanks
David
> ---
> 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
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list