Consider a situation where you have a file handle and would like to open a new file handle from it. You might want to do this because you need different access rights, or perhaps you want the two handles to have separate file offsets. You can't simply open the file again from a path because the file in question is unlinked; it's only accessible through the file handle you hold.
What doesn't work (as these only create a new handle to existing file description, i.e. shared file offset):
DuplicateHandle(Win32)dupfcntl+F_DUPFD
I have found the following options available on various platforms and would like to know if I am missing any.
Windows
ReOpenFile(since Vista)
Linux
open+ /proc/self/fd/
FreeBSD
open+ /dev/fd (only if fdescfs was mounted with the "nodup" option)openat+O_EMPTY_PATH
OS X
- Nothing.