… | |
… | |
379 | struct io_uring_sqe *sqe = iouring_sqe_get (EV_A); |
379 | struct io_uring_sqe *sqe = iouring_sqe_get (EV_A); |
380 | sqe->opcode = IORING_OP_POLL_REMOVE; |
380 | sqe->opcode = IORING_OP_POLL_REMOVE; |
381 | sqe->fd = fd; |
381 | sqe->fd = fd; |
382 | sqe->user_data = -1; |
382 | sqe->user_data = -1; |
383 | iouring_sqe_submit (EV_A_ sqe); |
383 | iouring_sqe_submit (EV_A_ sqe); |
384 | } |
|
|
385 | |
384 | |
386 | /* increment generation counter to avoid handling old events */ |
385 | /* increment generation counter to avoid handling old events */ |
387 | ++anfds [fd].egen; |
386 | ++anfds [fd].egen; |
|
|
387 | } |
388 | |
388 | |
389 | if (nev) |
389 | if (nev) |
390 | { |
390 | { |
391 | struct io_uring_sqe *sqe = iouring_sqe_get (EV_A); |
391 | struct io_uring_sqe *sqe = iouring_sqe_get (EV_A); |
392 | sqe->opcode = IORING_OP_POLL_ADD; |
392 | sqe->opcode = IORING_OP_POLL_ADD; |
393 | sqe->fd = fd; |
393 | sqe->fd = fd; |
394 | sqe->user_data = (uint32_t)fd | ((__u64)anfds [fd].egen << 32); |
394 | sqe->user_data = (uint32_t)fd | ((__u64)(uint32_t)anfds [fd].egen << 32); |
395 | sqe->poll_events = |
395 | sqe->poll_events = |
396 | (nev & EV_READ ? POLLIN : 0) |
396 | (nev & EV_READ ? POLLIN : 0) |
397 | | (nev & EV_WRITE ? POLLOUT : 0); |
397 | | (nev & EV_WRITE ? POLLOUT : 0); |
398 | iouring_sqe_submit (EV_A_ sqe); |
398 | iouring_sqe_submit (EV_A_ sqe); |
399 | } |
399 | } |
… | |
… | |
442 | * to get error codes at all. still, why not document this? |
442 | * to get error codes at all. still, why not document this? |
443 | */ |
443 | */ |
444 | |
444 | |
445 | /* ignore event if generation doesn't match */ |
445 | /* ignore event if generation doesn't match */ |
446 | /* this should actually be very rare */ |
446 | /* this should actually be very rare */ |
447 | if (ecb_expect_false ((uint32_t)anfds [fd].egen != gen)) |
447 | if (ecb_expect_false (gen != (uint32_t)anfds [fd].egen)) |
448 | return; |
448 | return; |
449 | |
449 | |
450 | if (ecb_expect_false (res < 0)) |
450 | if (ecb_expect_false (res < 0)) |
451 | { |
451 | { |
452 | if (res == -EINVAL) |
452 | if (res == -EINVAL) |