… | |
… | |
266 | |
266 | |
267 | /* io_uring_enter might fail with EBUSY and won't submit anything */ |
267 | /* io_uring_enter might fail with EBUSY and won't submit anything */ |
268 | /* unfortunately, we can't handle this at the moment */ |
268 | /* unfortunately, we can't handle this at the moment */ |
269 | |
269 | |
270 | if (res < 0 && errno == EBUSY) |
270 | if (res < 0 && errno == EBUSY) |
|
|
271 | /* the sane thing might be to resize, but we can't */ |
271 | //TODO |
272 | //TODO |
272 | ev_syserr ("(libev) io_uring_enter could not clear sq"); |
273 | ev_syserr ("(libev) io_uring_enter could not clear sq"); |
273 | else |
274 | else |
274 | break; |
275 | break; |
275 | |
276 | |
… | |
… | |
438 | /* Jens Axboe notified me that user_data is not what is documented, but is |
439 | /* Jens Axboe notified me that user_data is not what is documented, but is |
439 | * some kind of unique ID that has to match, otherwise the request cannot |
440 | * some kind of unique ID that has to match, otherwise the request cannot |
440 | * be removed. Since we don't *really* have that, we pass in the old |
441 | * be removed. Since we don't *really* have that, we pass in the old |
441 | * generation counter - if that fails, too bad, it will hopefully be removed |
442 | * generation counter - if that fails, too bad, it will hopefully be removed |
442 | * at close time and then be ignored. */ |
443 | * at close time and then be ignored. */ |
443 | sqe->user_data = (uint32_t)fd | ((__u64)(uint32_t)anfds [fd].egen << 32); |
444 | sqe->addr = (uint32_t)fd | ((__u64)(uint32_t)anfds [fd].egen << 32); |
|
|
445 | sqe->user_data = (uint64_t)-1; |
444 | iouring_sqe_submit (EV_A_ sqe); |
446 | iouring_sqe_submit (EV_A_ sqe); |
445 | |
447 | |
446 | /* increment generation counter to avoid handling old events */ |
448 | /* increment generation counter to avoid handling old events */ |
447 | ++anfds [fd].egen; |
449 | ++anfds [fd].egen; |
448 | } |
450 | } |
… | |
… | |
488 | iouring_process_cqe (EV_P_ struct io_uring_cqe *cqe) |
490 | iouring_process_cqe (EV_P_ struct io_uring_cqe *cqe) |
489 | { |
491 | { |
490 | int fd = cqe->user_data & 0xffffffffU; |
492 | int fd = cqe->user_data & 0xffffffffU; |
491 | uint32_t gen = cqe->user_data >> 32; |
493 | uint32_t gen = cqe->user_data >> 32; |
492 | int res = cqe->res; |
494 | int res = cqe->res; |
|
|
495 | |
|
|
496 | /* user_data -1 is a remove that we are not atm. interested in */ |
|
|
497 | if (cqe->user_data == (uint64_t)-1) |
|
|
498 | return; |
493 | |
499 | |
494 | assert (("libev: io_uring fd must be in-bounds", fd >= 0 && fd < anfdmax)); |
500 | assert (("libev: io_uring fd must be in-bounds", fd >= 0 && fd < anfdmax)); |
495 | |
501 | |
496 | /* documentation lies, of course. the result value is NOT like |
502 | /* documentation lies, of course. the result value is NOT like |
497 | * normal syscalls, but like linux raw syscalls, i.e. negative |
503 | * normal syscalls, but like linux raw syscalls, i.e. negative |