Prevent a process from opening a file more than once

Bernd Petrovitsch bernd at petrovitsch.priv.at
Wed Sep 28 08:12:07 EDT 2011


Hi!

First, no need to send HTML parts.

On Mit, 2011-09-28 at 07:41 +0200, Michael Blizek wrote:
[...]
> You could create something like this:
[...]

Yes, that's the solution.

But keep in mind that userspace also have the dup() and dup2() sys-call
which duplicate the file descriptor (within the same process) and there
is AFAIK no way to even detect that - let alone disallow it.
And after a fork(), it's more or less the same (except that the open
file descriptors belong to different processes ....).

Generally, I wonder why that is even necessary.

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at




More information about the Kernelnewbies mailing list