Open magicant opened 3 years ago
It may be helpful to have a set of internally used file descriptors as one of application-managed attributes. Such FDs can be redirections' saved FD, pipes for sending here-document contents, interactive shell's tty, etc.
Such FDs are invisible from the user, so they must move to other unused FDs when the user performs redirections on them. We can use Rc<Cell<Fd>>
to keep track of where these FDs moved.
The CLOEXEC flag indicates whether an FD is internal, so we don't necessarily need an FD set. We don't have to think about FDs moving as long as we don't support overwriting internal FDs.
This is a tracking issue for implementation of shell environment.
Items
$?
$$
6c3d04d$0
83d54d93198e8202700f9bde267ca0250a94aefaItems marked * are defined in POSIX.
Possible optimizations