<div class="gmail_quote">On Tue, Sep 27, 2011 at 5:22 PM, Mulyadi Santosa <span dir="ltr"><<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi :)<br>
<div><div></div><div class="h5"><br>
On Wed, Sep 28, 2011 at 06:56, Venkatram Tummala <<a href="mailto:venkatram867@gmail.com">venkatram867@gmail.com</a>> wrote:<br>
> Hi All,<br>
> I have a simple device driver which creates a /dev/XYZ file. I need to<br>
> prevent a process from opening the file more than once. However, multiple<br>
> processes can open the file simultaneously. Is there any any elegant way to<br>
> do this other than checking all opened files in the process ?<br>
<br>
</div></div>Uhm, keep a reference count and increment it on every file open in<br>
your module? How does that sound?<br></blockquote><div>Well, which refcount should i use? I can't use the refcount in the file object as the file objects passed to me are different each time the file is opened in the process.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
--<br>
regards,<br>
<br>
Mulyadi Santosa<br>
Freelance Linux trainer and consultant<br>
<br>
blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
</font></blockquote></div><br>