Date: Tue, 13 Feb 2001 11:40:22 -0800 (PST) From: Luigi Rizzo <rizzo@aciri.org> To: daverufino@btinternet.com (David Rufino) Cc: hackers@FreeBSD.ORG Subject: Re: character device driver Message-ID: <200102131940.f1DJeMH34966@iguana.aciri.org> In-Reply-To: <20010213193150.A882@btinternet.com> from David Rufino at "Feb 13, 2001 7:31:50 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 ? Thanks. allocation is easy -- what is complex is looking up the private data on each system calls because you usually have no reference to which instance of the open() the syscall refers to. A hack that can work in some cases (ioctl and some other calls do include the necessary info) is to use the process id of the caller to differentiate. But you must be careful about processes forking and passing fd's to their children... cheers luigi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102131940.f1DJeMH34966>