Messages in this thread | | | Subject | Re: How do I ask: How many processes have this file open now? | From | (Aaron M. Ucko) | Date | 23 May 1998 14:56:56 -0500 |
| |
David Woodhouse <Dave@imladris.demon.co.uk> writes:
> russ@taylor.digex.net said: > > Is there a system call for a user program that will, given a filename > > (or fd), return the number of processes with that file open? > > Not AFAIK. > fuser(1) does it by parsing all the cwd, fd, maps etc. entries in /proc
You might also want to take a look at lsof(1), which does everything fuser does and more, all in user space (taking full advantage of /proc; I don't think it has to resort to kmem on Linux.). Note that Red Hat ships fuser but not lsof, so you may need to track it down.
-- Aaron M. Ucko <amu@mit.edu> (finger amu@monk.mit.edu) [Stark raving sane]
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |