/dev/fd/N not synonymous with file descriptor N; it is on Linux
Corinna Vinschen
corinna-cygwin@cygwin.com
Sun Dec 16 21:55:00 GMT 2018
On Dec 16 13:36, Wayne Davison wrote:
> 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
> lsof info.
>
> > 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
Nice try, but hardlinks don't cross FS borders. /proc is a filesystem
on its own with its own inode numbers.
I'm mulling over adding some hack to open(). It could try to recognize
the special case of opening a processes' own descriptor symlink within
/proc and then warp the open() call into dup(). No idea how tricky
or even feasible that is, though...
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20181216/67b4be57/attachment.sig>
More information about the Cygwin
mailing list