This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
Re: Symlinks under /proc
On Tue, Feb 01, 2005 at 10:29:04AM -0500, Igor Pechtchanski wrote:
>On Tue, 1 Feb 2005, Corinna Vinschen wrote:
>
>> On Feb 1 09:38, Igor Pechtchanski wrote:
>> > On Tue, 1 Feb 2005, Corinna Vinschen wrote:
>> > > Correct. The name for pipes and, FWIW, AF_INET sockets, is generated
>> > > following the Linux naming rules, but it's not possible to resolve it.
>> > > I'm not sure how to implement that right now.
>> >
>> > Looks like Linux resolves this at the kernel level, in the link processing
>> > code. The following (on Linux) shows that the link target is not resolved
>> > outside of a link:
>>
>> I've checked in code which allows to resolve pipes and sockets. In
>> contrast to Linux, the patch does not allow to re-open the pipe. Instead,
>> it behaves as if the process tries to oopen a socket, it returns -1 and
>> sets errno to ENXIO.
>>
>> I have a vague idea how to implement opening such a pipe of another
>> process, but I have to mull over it a bit longer.
>
>Great, thanks -- I'll test it as soon as I have the time to rebuild from
>CVS. For implementing /dev/std*, there's no need to allow opening the
>pipes from another process, as any process accessing /dev/stdin will be
>accessing its own fd/0. I'm not even sure Linux allows other processes to
>access these pipes.
Linux does allow this, or at least some versions do. I wrote a perverted
script which relies on this behavior once. I tried to use fifos but the
process I was using barfed on them, so I passed /proc/$$/fd/4 as an argument
to the process and it worked.
Of course, in this case, fd 4 was also opened in the child process so it's
possible that this wouldn't work in an unrelated process which hadn't opened
the pipe.
cgf