IO-Uring Archive on
 help / color / 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.


- Josh Triplett

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

only message in thread, back to index

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

IO-Uring Archive on

Archives are clonable:
	git clone --mirror io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ \
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone