This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
Re: Symlinks under /proc
On Tue, 1 Feb 2005, Corinna Vinschen wrote:
> On Feb 1 10:29, Igor Pechtchanski wrote:
> > As far as reopening a pipe, I'm having a hard time visualizing a situation
> > where this would happen. What would be an example of code that does it?
> > An lseek on /dev/stdin?
>
> I have no idea how a useful example looks like, but try this:
>
> Session 1:
> $ cat <very_long_file> | less
>
> Session 2:
>
> $ ps -ef | grep cat
> [...]
> corinna 32461 32328 0 16:38 pts/8 00:00:00 cat <very_long_file>
> $ ls -l /proc/32461/fd
> total 4
> lrwx------ 1 corinna users 64 2005-02-01 16:39 0 -> /dev/pts/8
> l-wx------ 1 corinna users 64 2005-02-01 16:39 1 -> pipe:[545936]
> lrwx------ 1 corinna users 64 2005-02-01 16:38 2 -> /dev/pts/8
> lr-x------ 1 corinna users 64 2005-02-01 16:39 3 -> <very_long_file>
> $ less -f /proc/32461/fd/1
>
> Surprise, surprise...
It certainly is. So Linux *does* allow opening another process's pipe.
But I doubt most applications will want to do this, so unless there's an
outcry for this kind of thing, it's probably not necessary to support it
in Cygwin.
Is that what you meant by "re-opening" the pipe? If so, let's not bother
for now.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT