Prevent a process from opening a file more than once
venkatram867 at gmail.com
Tue Sep 27 20:30:31 EDT 2011
On Tue, Sep 27, 2011 at 5:22 PM, Mulyadi Santosa
<mulyadi.santosa at gmail.com>wrote:
> Hi :)
> On Wed, Sep 28, 2011 at 06:56, Venkatram Tummala <venkatram867 at gmail.com>
> > Hi All,
> > I have a simple device driver which creates a /dev/XYZ file. I need to
> > prevent a process from opening the file more than once. However, multiple
> > processes can open the file simultaneously. Is there any any elegant way
> > do this other than checking all opened files in the process ?
> Uhm, keep a reference count and increment it on every file open in
> your module? How does that sound?
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.
> Mulyadi Santosa
> Freelance Linux trainer and consultant
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Kernelnewbies