From owner-freebsd-current Mon Jun 10 15:32:28 2002 Delivered-To: freebsd-current@freebsd.org Received: from vbook.express.ru (vbook.nc.express.ru [212.24.37.35]) by hub.freebsd.org (Postfix) with ESMTP id B95FA37B401 for ; Mon, 10 Jun 2002 15:32:19 -0700 (PDT) Received: from vova by vbook.express.ru with local (Exim 3.36 #1) id 17HXhn-0000Tz-00; Tue, 11 Jun 2002 02:32:07 +0400 Subject: Re: Device cloning From: "Vladimir B. " Grebenschikov To: Poul-Henning Kamp Cc: Maksim Yevmenkin , "current@freebsd.org" In-Reply-To: <29346.1023743719@critter.freebsd.dk> References: <29346.1023743719@critter.freebsd.dk> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable X-Mailer: Ximian Evolution 1.0.5 Date: 11 Jun 2002 02:32:06 +0400 Message-Id: <1023748326.595.69.camel@vbook.express.ru> Mime-Version: 1.0 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 =F7 Tue, 11.06.2002, =D7 01:15, Poul-Henning Kamp =CE=C1=D0=C9=D3=C1=CC: > In message <20020610211347.71117.qmail@web13305.mail.yahoo.com>, Maksim Y= evmenk > in writes: > >Hackers, > > > >The project i'm working on might require some sort of > >device cloning. The current way of cloning, i.e. use > >DEVFS and allocate unique minor numbers, is not very > >good for my purpose. > > > >The idea is simple: the same device(major,minor) can > >be opened several times by different processes (or > >possibly threads within the same process) and each > >process (thread) will have unique device instance.=20 >=20 > Sorry, but this wont work for a large number of reasons. >=20 > For one thing none of the dup(2) or fork(2) like systemcalls > report what happens to the filedescriptors down to the > device drivers so you have no way to correctly track which > process or which instance you are working on. As far as I understand _key_ word is "open", each new instance appears on open(), but fork() and dup() only do regular work. dup'ed or fork'ed descriptors will be same from driver's point of view, but each new open() will create new instance. > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe =20 > Never attribute to malice what can adequately be explained by incompetenc= e. =20 --=20 Vladimir B. Grebenschikov vova@sw.ru, SWsoft, Inc. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message