From owner-freebsd-hackers Tue Feb 13 21:47:13 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id 088C437B4EC for ; Tue, 13 Feb 2001 21:47:08 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.1/8.11.1) with ESMTP id f1E5l0w55058; Wed, 14 Feb 2001 06:47:01 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Warner Losh Cc: Luigi Rizzo , daverufino@btinternet.com, hackers@FreeBSD.ORG Subject: Re: character device driver In-Reply-To: Your message of "Tue, 13 Feb 2001 15:02:00 MST." <200102132202.f1DM20W41714@harmony.village.org> Date: Wed, 14 Feb 2001 06:47:00 +0100 Message-ID: <55056.982129620@critter> From: Poul-Henning Kamp Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200102132202.f1DM20W41714@harmony.village.org>, Warner Losh writes: >In message <200102132151.f1DLpVZ38897@iguana.aciri.org> Luigi Rizzo writes: >: > In message <20010213193150.A882@btinternet.com> David Rufino writes: >: > : 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 ? Thanks. >: > >: > No. You only get one close call and in the kernel all instances of a >: > minor device are treated identically. >: >: this is not true anymore, there is some special flag you can >: specify in cdevsw or so which passes all close calls to the driver. > >It is only half untrue. There's a special flag to get all calls to >close, but you have no way of knowing which instance of the minor >device is being closed because they are all identical in the kernel's >eyes. And you actually cannot know how many filedescriptors are open in how many processes because neither dup(2) nor fork(2) result in a (pseudo-)open call. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message