001-timerfd.patch 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. commit cadb77d99e314e42c3eb02d016e9d90136ec6959
  2. Author: Alexander Gordeev <lasaine@lvk.cs.msu.su>
  3. Date: Thu Jan 27 06:39:16 2011 +0300
  4. fix timerfd initialization
  5. sys/timerfd.h defines TFD_NONBLOCK as 0x800 but in kernel TFD_NONBLOCK
  6. is an alias for O_NONBLOCK which is defined in arch-specific fcntl.h.
  7. While it's still 0x800 for most of archs but for mips it's 0x80. So
  8. timerfd_create(..., TFD_NONBLOCK) returns -EINVAL because of that. Fix
  9. this by using O_NONBLOCK instead.
  10. Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su>
  11. --- a/libusb/io.c
  12. +++ b/libusb/io.c
  13. @@ -32,6 +32,7 @@
  14. #include <sys/time.h>
  15. #endif
  16. #ifdef USBI_TIMERFD_AVAILABLE
  17. +#include <fcntl.h>
  18. #include <sys/timerfd.h>
  19. #endif
  20. @@ -1141,7 +1142,7 @@ int usbi_io_init(struct libusb_context *
  21. #ifdef USBI_TIMERFD_AVAILABLE
  22. ctx->timerfd = timerfd_create(usbi_backend->get_timerfd_clockid(),
  23. - TFD_NONBLOCK);
  24. + O_NONBLOCK);
  25. if (ctx->timerfd >= 0) {
  26. usbi_dbg("using timerfd for timeouts");
  27. r = usbi_add_pollfd(ctx, ctx->timerfd, POLLIN);