From owner-freebsd-hackers Sun Feb 18 15:17:34 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from chopper.Poohsticks.ORG (chopper.poohsticks.org [63.227.60.73]) by hub.freebsd.org (Postfix) with ESMTP id 14AEE37B503 for ; Sun, 18 Feb 2001 15:17:32 -0800 (PST) Received: from chopper.Poohsticks.ORG (drew@localhost.poohsticks.org [127.0.0.1]) by chopper.Poohsticks.ORG (8.10.1/8.10.1) with ESMTP id f1INHTn24123; Sun, 18 Feb 2001 16:17:29 -0700 Message-Id: <200102182317.f1INHTn24123@chopper.Poohsticks.ORG> To: David Rufino Cc: hackers@FreeBSD.ORG Subject: Re: character device driver In-reply-to: Your message of "Tue, 13 Feb 2001 19:31:50 GMT." <20010213193150.A882@btinternet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24119.982538249.1@chopper.Poohsticks.ORG> Date: Sun, 18 Feb 2001 16:17:29 -0700 From: Drew Eckhardt Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <20010213193150.A882@btinternet.com>, daverufino@btinternet.com writ es: >Hi, > >I'm writing a character device driver in which each minor device can be >opened more than once. When a device is opened is there a way to associate >some private data for each opened instance ? As other people have noted, not in the general case. The solution I've used is to split the device minor number into a physical unit and open instance part. You keep the existing per-unit structure, and add per-instance data including a busy flag which causes opens to return EBUSY. In your user land application, you iterate over the devices in round-robin fashion as long as you get back EBUSY as you would for pty masters. -- Home Page For those who do, no explanation is necessary. For those who don't, no explanation is possible. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message