--- libev/ev_iouring.c 2019/07/02 06:07:54 1.1 +++ libev/ev_iouring.c 2019/08/17 05:30:16 1.3 @@ -381,17 +381,17 @@ sqe->fd = fd; sqe->user_data = -1; iouring_sqe_submit (EV_A_ sqe); - } - /* increment generation counter to avoid handling old events */ - ++anfds [fd].egen; + /* increment generation counter to avoid handling old events */ + ++anfds [fd].egen; + } if (nev) { struct io_uring_sqe *sqe = iouring_sqe_get (EV_A); sqe->opcode = IORING_OP_POLL_ADD; sqe->fd = fd; - sqe->user_data = (uint32_t)fd | ((__u64)anfds [fd].egen << 32); + sqe->user_data = (uint32_t)fd | ((__u64)(uint32_t)anfds [fd].egen << 32); sqe->poll_events = (nev & EV_READ ? POLLIN : 0) | (nev & EV_WRITE ? POLLOUT : 0); @@ -444,7 +444,7 @@ /* ignore event if generation doesn't match */ /* this should actually be very rare */ - if (ecb_expect_false ((uint32_t)anfds [fd].egen != gen)) + if (ecb_expect_false (gen != (uint32_t)anfds [fd].egen)) return; if (ecb_expect_false (res < 0)) @@ -576,7 +576,7 @@ { /* if we have events, no need for extra syscalls, but we might have to queue events */ if (iouring_handle_cq (EV_A)) - timeout = 0.; + timeout = EV_TS_CONST (0.); else /* no events, so maybe wait for some */ iouring_tfd_update (EV_A_ timeout); @@ -589,7 +589,7 @@ EV_RELEASE_CB; res = evsys_io_uring_enter (iouring_fd, iouring_to_submit, 1, - timeout ? IORING_ENTER_GETEVENTS : 0, 0, 0); + timeout > EV_TS_CONST (0.) ? IORING_ENTER_GETEVENTS : 0, 0, 0); iouring_to_submit = 0; EV_ACQUIRE_CB;