使用io_uring链接超时与poll_multishot时返回-EINVAL的问题咨询
io_uring链接超时与poll_multishot时返回-EINVAL的问题咨询
大家好,我最近在折腾io_uring,想实现一个带自动超时取消的poll_multishot提交逻辑,写了个函数但一直返回-EINVAL,实在找不到问题所在,想请教下各位。
我原本的思路是提交一个poll_multishot的sqe,然后链接一个超时sqe,让超时后自动取消这个poll操作,目前的函数代码如下:
int upollm(conn_t *conn, uint bit_mask, uint64_t sec, uint64_t nsec) { struct io_uring_sqe *sqe = io_uring_get_sqe(&ring); if (!sqe) return -1; conn->op = IORING_POLL_ADD_MULTI; sqe->user_data = (__u64)conn; sqe->flags |= IOSQE_IO_LINK; io_uring_prep_poll_multishot(sqe, conn->fd, bit_mask); sqe = io_uring_get_sqe(&ring); if (!sqe) return -1; }
后续准备超时sqe的代码还没写完,但目前调用这个函数就已经返回-EINVAL了。有没有大佬能帮我分析下,是不是链接poll_multishot和超时sqe的方式有问题?或者是我哪里参数设置错了?
备注:内容来源于stack exchange,提问作者user30393367
相关产品推荐
相关产品推荐

