This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Symlinks under /proc


On Feb  1 10:29, Igor Pechtchanski wrote:
> On Tue, 1 Feb 2005, Corinna Vinschen wrote:
> > 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.
> 
> 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...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]