--- libev/ev_iouring.c 2019/07/02 06:07:54 1.1 +++ libev/ev_iouring.c 2019/11/19 13:09:00 1.5 @@ -363,7 +363,6 @@ static void iouring_modify (EV_P_ int fd, int oev, int nev) { - fprintf (stderr,"modify %d (%d, %d) %d\n", fd, oev,nev, anfds[fd].eflags);//D if (ecb_expect_false (anfds [fd].eflags)) { /* we handed this fd over to epoll, so undo this first */ @@ -381,17 +380,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 +443,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)) @@ -473,8 +472,6 @@ return; } - fprintf (stderr, "fd %d event, rearm\n", fd);//D - /* feed events, we do not expect or handle POLLNVAL */ fd_event ( EV_A_ @@ -576,7 +573,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 +586,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; @@ -611,7 +608,7 @@ if (!epoll_init (EV_A_ 0)) return 0; - ev_io_init (EV_A_ &iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); + ev_io_init (&iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); ev_set_priority (&iouring_epoll_w, EV_MAXPRI); ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ);