Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux
- Date: Sun, 16 Dec 2018 13:36:10 -0800
- From: Wayne Davison <wayne@xxxxxxxxxxxxx>
- Subject: Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux
On Sun, Dec 16, 2018 at 12:29 PM Corinna Vinschen wrote:
> In contrast to Linux the symlinks are not just faked symlinks with the underlying OS having direct access to the file descriptors.
Yeah, Linux is more like a fuse where the open filehandles are used
directly on open, and the stat calls return pretend symlinks with the
> The way it's implemented in Cygwin uses the actual file path resolution and then either works or fails as above.
If Cygwin can't be changed into a fuse idiom, perhaps a hard-link
idiom could be used? For instance, when the /proc/$PID/fd/0 symlink is
being created, the code could try to hard-link the file to
/proc/$PID/.fd/0 first (note the dot-fd) before creating the normal
fd/0 symlink. Then, when a request came in to read /proc/$PID/fd/0, it
could check if the associated hard-link exists and read from that
instead. Or perhaps the "symlink" info could be stored elsewhere and
the fd/0 file could be the hard-link, requiring the stat code to be
tweaked to look up the pretend-symlink info?
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple