Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Aug 2002 09:33:20 -0500
From:      Chris Costello <chris@FreeBSD.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        Christian Weisgerber <naddy@mips.inka.de>, freebsd-current@FreeBSD.org
Subject:   Re: devfs, fdescfs: /dev/fd problems
Message-ID:  <20020807143319.GA1620@holly.calldei.com>
In-Reply-To: <Pine.NEB.3.96L.1020807101904.9441C-100000@fledge.watson.org>
References:  <20020806185240.GA3138@holly.calldei.com> <Pine.NEB.3.96L.1020807101904.9441C-100000@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, August 07, 2002, Robert Watson wrote:
> On Tue, 6 Aug 2002, Chris Costello wrote:
> >    I can't explain why there's even a pipe open on fd #63, but the
> > reason you're only going to see 0, 1 and 2 is because that's just how
> > devfs's implementation of /dev/fd works.  The last time we (phk and I)
> > looked at duplicating the fdescfs code in devfs it was obvious it would
> > require ugly hacks to get it to work, so it was decided that devfs would
> > only provide support for /dev/fd/[0-2] so we can have
> > /dev/std{in,out,err} as symlinks to them.  fdescfs (should) just export
> > the calling process's file table as a set of vnodes. 
> 
> Many things found attached to the file table are not vnodes, making the
> notion of a vnode from them a little odd.  In particular, pipes are not
> vnodes, and sockets are not vnodes. :-)

   Yes, but we do well to make believe that they are just until
the process can call open(), which is really just dup() in
disguise.  They show up as FS entries as well:

# ls -l /dev/fd | tee /dev/null
total 16
crw-------  1 chris  tty      5,   2 Aug  7 09:18 0
p---------  1 root   wheel         0 Aug  7 09:18 1
crw-------  1 chris  tty      5,   2 Aug  7 09:18 2
d-w-------  1 chris  chris       512 Aug  7 01:16 3
d---------  1 root   wheel       512 Aug  7 01:04 4

   (Noting that fstat() on pipes now seems to be broken in that
it does not return any file permissions -- IIRC, it used to.)

-- 
Chris Costello                                <chris@FreeBSD.org>
FreeBSD Project                           http://www.FreeBSD.org/
TrustedBSD Project                     http://www.TrustedBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020807143319.GA1620>