Date: Fri, 01 Aug 1997 12:23:48 -0700 From: Amancio Hasty <hasty@rah.star-gate.com> To: Terry Lambert <terry@lambert.org> Cc: msmith@atrad.adelaide.edu.au (Michael Smith), luigi@labinfo.iet.unipi.it, hackers@FreeBSD.ORG Subject: Re: device close behaviour - a question Message-ID: <199708011923.MAA05657@rah.star-gate.com> In-Reply-To: Your message of "Fri, 01 Aug 1997 10:40:34 PDT." <199708011740.KAA09486@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Curious, shouldn't the responsibility of managing the behavior of open/close fall on the device driver . After all the driver should dictate whether it can manage multiple open instances. As for determining whether there are multiple opens on a device we can create an ioctl which returns the number of opens . Ideally, it should return instances of the states for each open. Amancio >From The Desk Of Terry Lambert : > > > I am having a problem related to the having multiple (actually, > > > 2) open descriptors on the same character device. More specifically, > > > I notice that only the last close does actually invoke the device > > > close routine. > > > > Heh. This one is tricky. > > Poul-Henning was talking about this before on the -current list. > > In general, I believe everyone agreed that it was desirable to > differentiate between "close" and "last close" to provide for > "per open instance" private data on devices. > > There is an issue on open, as well, since a device may be > instanced once, but have multiple references created for it > (Mike's inheritance of fd's on fork() or on exec() without > the close-on-exec flag set via fcntl() is one example of this). > > The issue is that there is not a semantic seperation between > reference instance vs. device instance at open time, so a close > differentiation is less than useful. Both corrections would > need to occur simultaneously for either one to be useful alone. > > > > You cannot ever guarantee any fixed number of openers on a device. > > O_EXCL or function equivalent. > > > Terry Lambert > terry@lambert.org > --- > Any opinions in this posting are my own and not those of my present > or previous employers. >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708011923.MAA05657>