Draft: Cross scheme links (scheme file forwarding)
Implements cross scheme links, i.e. allows a scheme to return a file descriptor pertaining to different schemes than that scheme itself. This is implemented here both for SYS_OPEN
and SYS_DUP
.
This doubles the size of UserInner
's done
waitmap value, but since those are stored in a B-tree in the first place with a relatively small branching factor, it will most likely not have much of an effect besides memory use. An error code could otherwise get reserved for the kernel allowing it to look elsewhere for the new file descriptor if this turns out to be a performance problem.
Right now it uses a message to respond to SYS_OPEN and SYS_DUP syscalls, just like with SYS_FEVENT. While it would be possible to constrain the FD size from 63 bits to 62 bits, this feels to me like an unnecessary limitation e.g. given that schemes might use FDs directly for pointers. That would allow SchemeBlock
and SchemeBlockMut
to remain unchanged, but (1) I don't see how those schemes would benefit from FD forwarding, and (2) we might get better async scheme interfaces later with io_uring.
Forwarded file descriptors will be removed from the scheme handler's file descriptor table, so they will have to be dup
licated first if the scheme handler really wants to keep them.
Blocked on syscall!69 (closed)