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