Re: Chaining accept+read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/28/22 10:50, Ben Noordhuis wrote:
I'm trying to chain accept+read but it's not working.

My code looks like this:

     *sqe1 = (struct io_uring_sqe){
       .opcode     = IORING_OP_ACCEPT,
       .flags      = IOSQE_IO_LINK,
       .fd         = listenfd,
       .file_index = 42, // or 42+1
     };
     *sqe2 = (struct io_uring_sqe){
       .opcode     = IORING_OP_READ,
       .flags      = IOSQE_FIXED_FILE,
       .addr       = (u64) buf,
       .len        = len,
       .fd         = 42,
     };
     submit();

Both ops fail immediately; accept with -ECANCELED, read with -EBADF,
presumably because fixed fd 42 doesn't exist at the time of submission.

Would it be possible to support this pattern in io_uring or are there
reasons for why things are the way they are?

It should already be supported. And errors look a bit odd, I'd rather
expect -EBADF or some other for accept and -ECANCELED for the read.
Do you have a test program / reporoducer? Hopefully in C.

--
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux