If one has an O_PATH fd and wants to re-open an operable version, there are two options currently:
- If fd refers to a directory
openat (fd, ".", O_DIRECTORY | ...);
- otherwise
open ("/proc/self/fd/$FD", ...);
The dependency on procfs is not great. It would be nice if openat worked on an empty path.
FreeBSD has O_EMPTY_PATH for openat, and fstatat and others have AT_EMPTY_PATH.
If one has an O_PATH fd and wants to re-open an operable version, there are two options currently:
openat (fd, ".", O_DIRECTORY | ...);open ("/proc/self/fd/$FD", ...);The dependency on procfs is not great. It would be nice if openat worked on an empty path.
FreeBSD has
O_EMPTY_PATHforopenat, andfstatatand others haveAT_EMPTY_PATH.