ksudarsh@oracle.uucp (Krishna Sudarshan) (04/05/91)
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? -Krishna
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (04/07/91)
In article <1991Apr5.070131.12198@oracle.com> ksudarsh@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