Core: Improve instrumentation of timerfd_settime failures
authorPete Batard <pete@akeo.ie>
Sun, 12 Aug 2012 21:37:02 +0000 (22:37 +0100)
committerPete Batard <pete@akeo.ie>
Sun, 12 Aug 2012 21:37:02 +0000 (22:37 +0100)
* Report errno as well as itimerspec data
* Also reuse the timeout variable set to &transfer->timeout

libusb/io.c
libusb/version_nano.h

index e6d4132..902be15 100644 (file)
@@ -1199,12 +1199,13 @@ out:
                /* if this transfer has the lowest timeout of all active transfers,
                 * rearm the timerfd with this transfer's timeout */
                const struct itimerspec it = { {0, 0},
-                       { transfer->timeout.tv_sec, transfer->timeout.tv_usec * 1000 } };
+                       { timeout->tv_sec, timeout->tv_usec * 1000 } };
                usbi_dbg("arm timerfd for timeout in %dms (first in line)",
                        USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
                r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
                if (r < 0) {
-                       usbi_warn(ctx, "failed to arm first timerfd (error %d)", r);
+                       usbi_warn(ctx, "failed to arm first timerfd (errno %d, it_value = %d:%d)",
+                               errno, it.it_value.tv_sec, it.it_value.tv_nsec);
                        r = LIBUSB_ERROR_OTHER;
                }
        }
index c52db03..5362c25 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10546
+#define LIBUSB_NANO 10547