From owner-freebsd-hackers Mon Dec 13 17:17:41 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp10.atl.mindspring.net (smtp10.atl.mindspring.net [207.69.200.246]) by hub.freebsd.org (Postfix) with ESMTP id 94E38152C5; Mon, 13 Dec 1999 17:17:28 -0800 (PST) (envelope-from vsilyaev@mindspring.com) Received: from mindspring.com (user-2ivebg7.dialup.mindspring.com [165.247.46.7]) by smtp10.atl.mindspring.net (8.9.3/8.8.5) with ESMTP id UAA02634; Mon, 13 Dec 1999 20:17:18 -0500 (EST) Received: (from vsilyaev@localhost) by mindspring.com (8.9.3/8.9.3) id UAA00374; Mon, 13 Dec 1999 20:16:01 -0500 (EST) (envelope-from vsilyaev) Date: Mon, 13 Dec 1999 20:16:00 -0500 From: "Vladimir N. Silyaev" To: Mike Smith Cc: "Vladimir N. Silyaev" , hackers@freebsd.org Subject: Re: Multiple instances of the same character device Message-ID: <19991213201600.A253@jupiter.delta.ny.us> References: <19991211173336.A635@jupiter.delta.ny.us> <199912130839.AAA06175@mass.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <199912130839.AAA06175@mass.cdrom.com>; from msmith@freebsd.org on Mon, Dec 13, 1999 at 12:39:42AM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Dec 13, 1999 at 12:39:42AM -0800, Mike Smith wrote: > > > > The question is very simple. Is it possible to open the same character > > pseudo device, for example /dev/foo0, simultaneously from other programs, and > > to work with this instances independently? > > Not in the fashion that I believe you're trying to do, no. > > > I'm asked as the developer of a driver with such requirements, so please > > don't complain about such technique. > > I think I'm going to complain anyway; this is an _extremely_ lame way to > do things, and it breaks many assumptions about how files are meant to > work. > > In your case, however, you can probably steal the 'emuldata' field in the > proc structure to store a pointer to your per-instance data. At some > stage, the Linux emulator will want to use this as well, and it will need > to provide an API for multiple emulator plugins to use. Oh no, I think it's a bad idea to store something in the proc structure, because program want two different devices with such semantics, and it some time 'forked'. And in common, it's a very dirty hack, and it's doesn't remove the 'last close' problem. Probably I'll be try to do something like 'rotated' symlink, or intercept linux open syscall and substitute devices like /dev/foo0a, /dev/foo0b, until don't open one. > > By then I hope that we'll have convinced the VMware folks to do things > properly, or have our own binary version... Ya-ya, I hope too. -- Vladimir Silyaev To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message