From owner-freebsd-hackers Sun Jan 12 11:20:03 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id LAA12034 for hackers-outgoing; Sun, 12 Jan 1997 11:20:03 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id LAA11992 for ; Sun, 12 Jan 1997 11:20:00 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id MAA25927; Sun, 12 Jan 1997 12:06:32 -0700 From: Terry Lambert Message-Id: <199701121906.MAA25927@phaeton.artisoft.com> Subject: Re: DEVFS permissions &c. To: davidn@unique.usn.blaze.net.au (David Nugent) Date: Sun, 12 Jan 1997 12:06:32 -0700 (MST) Cc: bde@zeta.org.au, joerg_wunsch@uriah.heep.sax.de, hackers@FreeBSD.org In-Reply-To: from "David Nugent" at Jan 12, 97 02:26:00 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > Bruce Evans writes: > > >> I've exchanged a couple of thoughts with Bruce about it. Maybe we > > >> could teach mtree(8) to help in this step. > > > > > >Yes, that would certainly be the way to do it. > > > > Not really. Things it doesn't do right include: > > - wildcards. The equivalent of `chmod 666 /dev/tty[pqrs][PQRS]*' is a > > huge list. > > This could be resolved. It will involve expanding mtree's syntax a > little (about which I admit to knowing next to nothing :-)), > but I believe the basic functionality should be part of mtree, or > if not mtree, then something along the same lines. Isn't this a non-starter? I mean, shouldn't pty's be handled by: int clonefd; int slavefd, masterfd; char ptypath[ MAXNAMLEN]; /* * Open clone device */ clonefd = open( "/dev/pty", O_RD); /* * Reserve cloned master/slave pair path */ ioctl( clonefd, PTYIOCALLOC, &ptypath); /* * Open reserved FS object (always 'master'). This will * hold the reference */ masterfd = open( ptypath, O_RDWR); /* * Now that rreference is held, clone device is not necessary */ close( clonefd); /* * Given an fd for the master, return an open fd on the slave; * it is not necessary for the slave to have an FS namespace * assignment (though it could, if it were needed for some * program for compatability. */ ioctl( masterfd, PTYIOCSLAVE, &slavefd); ... With 'ptypath' ending up containing something like "/dev/pty/000"... after all, there is no reason a "dir" can't be a device as well, since you can use VOP_READDIR() to iterate subdevices and VOP_READ() to operate on the device itself. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.