RFC: userspace-allocated file descriptors for "fixed files" for open?

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

 



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



[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