public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH WIP 0/3] Support userspace-selected fds
@ 2020-03-04 14:35 Josh Triplett
  2020-03-04 14:53 ` [PATCH WIP 1/3] fs: Support setting a minimum fd for "lowest available fd" allocation Josh Triplett
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Josh Triplett @ 2020-03-04 14:35 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Prototype of the proposal I made at
https://lore.kernel.org/io-uring/20200211223235.GA25104@localhost/ . See
also the discussion at
https://twitter.com/josh_triplett/status/1235004009502494721 .

The first patch is independent of the other two; it allows reserving
file descriptors below a certain minimum for userspace-selected fd
allocation only.

The second patch implements userspace-selected fd allocation for
openat2, introducing a new O_SPECIFIC_FD flag and an fd field in struct
open_how. In io_uring, this allows sequences like openat2/read/close
without waiting for the openat2 to complete. Multiple such sequences can
overlap, as long as each uses a distinct file descriptor.

The third patch adds userspace-selected fd allocation to pipe2 as well.
I did this partly as a demonstration of how simple it is to wire up
O_SPECIFIC_FD support for a new fd-allocating system call, and partly in
the hopes that this may make it more useful to wire up io_uring support
for pipe2 in the future.

Josh Triplett (3):
  fs: Support setting a minimum fd for "lowest available fd" allocation
  fs: openat2: Extend open_how to allow userspace-selected fds
  fs: pipe2: Support O_SPECIFIC_FD

 fs/fcntl.c                       |  2 +-
 fs/file.c                        | 62 ++++++++++++++++++++++++++++----
 fs/io_uring.c                    |  2 +-
 fs/open.c                        |  6 ++--
 fs/pipe.c                        | 15 +++++---
 include/linux/fcntl.h            |  5 +--
 include/linux/fdtable.h          |  1 +
 include/linux/file.h             |  3 ++
 include/uapi/asm-generic/fcntl.h |  4 +++
 include/uapi/linux/openat2.h     |  2 ++
 include/uapi/linux/prctl.h       |  4 +++
 kernel/sys.c                     | 10 ++++++
 12 files changed, 100 insertions(+), 16 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2020-03-04 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-04 14:35 [PATCH WIP 0/3] Support userspace-selected fds Josh Triplett
2020-03-04 14:53 ` [PATCH WIP 1/3] fs: Support setting a minimum fd for "lowest available fd" allocation Josh Triplett
2020-03-04 14:53 ` [PATCH WIP 2/3] fs: openat2: Extend open_how to allow userspace-selected fds Josh Triplett
2020-03-04 14:53 ` [PATCH WIP 3/3] fs: pipe2: Support O_SPECIFIC_FD Josh Triplett

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