io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: userspace-allocated file descriptors for "fixed files" for open?
@ 2020-02-11 22:32 Josh Triplett
  0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2020-02-11 22:32 UTC (permalink / raw)
  To: Jens Axboe, io-uring

The X Window System had a solution that allowed an asynchronous batch of
"create thing, do stuff with thing": X allowed the client to allocate
XIDs, and just had an operation for "give me an additional batch of XIDs
I can allocate".

Could we do the same thing in io_uring, as a variant of the "fixed file"
concept? Suppose that we add a call to preallocate a large contiguous
range of file descriptors, and ensure that the kernel never allocates
those file descriptors for an application.  We could then allow
userspace to *tell* the kernel to use a specific preallocated file
descriptor in that range when it does an OPENAT or OPENAT2 operation,
and then go on to use that file descriptor in a subsequent
read/write/close/etc operation.

(If the open operation returns an error, it won't have allocated that
file descriptor, so subsequent operations will just fail quickly with
EBADF, which seems fine.)

This seems simple for userspace to deal with, and would work for many
use cases.

Thoughts?

- Josh Triplett

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-11 22:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 22:32 RFC: userspace-allocated file descriptors for "fixed files" for open? Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).