From owner-freebsd-current Tue Aug 6 11:51:43 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2FE4D37B400 for ; Tue, 6 Aug 2002 11:51:41 -0700 (PDT) Received: from holly.calldei.com (adsl-208-191-149-232.dsl.hstntx.swbell.net [208.191.149.232]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8541943E5E for ; Tue, 6 Aug 2002 11:51:40 -0700 (PDT) (envelope-from chris@holly.dyndns.org) Received: by holly.calldei.com (Postfix, from userid 1001) id C3BBEB72; Tue, 6 Aug 2002 13:52:41 -0500 (CDT) Date: Tue, 6 Aug 2002 13:52:40 -0500 From: Chris Costello To: Christian Weisgerber Cc: freebsd-current@freebsd.org Subject: Re: devfs, fdescfs: /dev/fd problems Message-ID: <20020806185240.GA3138@holly.calldei.com> Reply-To: chris@FreeBSD.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Monday, August 05, 2002, Christian Weisgerber wrote: > Now let's try a program that lists the directory entries under > [devfs] /dev/fd: > > $ ./t <( : ) > 0 > 1 > 2 > Listing the entries under [fdescfs] /dev/fd gives something of a surprise: > > $ ./t <( : ) > 0 > 1 > 2 > 3 > > The descriptor used by readdir() is there, but the pipe on 63 is > still missing, although open()ing it obviously works. 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. -- Chris Costello 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