Core: Improve instrumentation of timerfd_settime failures

* Report errno as well as itimerspec data
* Also reuse the timeout variable set to &transfer->timeout
This commit is contained in:
Pete Batard 2012-08-12 22:37:02 +01:00
parent 2d7d3beccc
commit de56675c99
2 changed files with 4 additions and 3 deletions

View file

@ -1199,12 +1199,13 @@ out:
/* if this transfer has the lowest timeout of all active transfers, /* if this transfer has the lowest timeout of all active transfers,
* rearm the timerfd with this transfer's timeout */ * rearm the timerfd with this transfer's timeout */
const struct itimerspec it = { {0, 0}, 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_dbg("arm timerfd for timeout in %dms (first in line)",
USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout); USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)->timeout);
r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL); r = timerfd_settime(ctx->timerfd, TFD_TIMER_ABSTIME, &it, NULL);
if (r < 0) { 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; r = LIBUSB_ERROR_OTHER;
} }
} }

View file

@ -1 +1 @@
#define LIBUSB_NANO 10546 #define LIBUSB_NANO 10547