Inode Ref. Count

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Sun Apr 7 11:36:16 AEST 1991


In article <1991Apr5.070131.12198 at oracle.com> ksudarsh at oracle.uucp (Krishna Sudarshan) writes:
>     Is there any way of finding the number of active references to a file? Are
>     there system calls which could be used to tell you how many processes have
>     opened a given file?

The answer to both questions is ``not portably'' (from user-level code).
On most machines, if you can read /dev/kmem, you can go snooping through
the kernel to find the information for yourself. That's what programs
like ofiles and fstat do. But the code inside is anything but portable,
and normal users probably should not be given information about open
files in other processes.

What are you really trying to do?

---Dan



More information about the Comp.unix.questions mailing list