public inbox for [email protected]
 help / color / mirror / Atom feed
* Chaining accept+read
@ 2022-09-28  9:50 Ben Noordhuis
  2022-09-28 10:00 ` Pavel Begunkov
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Noordhuis @ 2022-09-28  9:50 UTC (permalink / raw)
  To: io-uring

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-28 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-28  9:50 Chaining accept+read Ben Noordhuis
2022-09-28 10:00 ` Pavel Begunkov
2022-09-28 10:55   ` Ben Noordhuis
2022-09-28 11:59     ` Pavel Begunkov
2022-09-28 13:49       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox