Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.questions Subject: Re: How determine if a file is opened by another process Keywords: file open Message-ID: <1991Feb05.045352.20892@convex.com> Date: 5 Feb 91 04:53:52 GMT References: <1991Jan29.204403.6071@rick.doc.ca> <1969@winnie.fit.edu> <56JF01yy18J=00@amdahl.uts.amdahl.com> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 38 Nntp-Posting-Host: pixel.convex.com From the keyboard of craft@uts.amdahl.com (Peter Craft): :In article <1969@winnie.fit.edu>, rrandall@zach.fit.edu (Rick Randall) writes: :> In article <1991Jan29.204403.6071@rick.doc.ca> andrew@calvin.doc.ca (Andrew Patrick) writes: :> >In article <1488@nixsin.UUCP> koerber.sin@nixdorf.com writes: :> > :> >>I want to find out, whether any process has opened a file, of which I only :> >>Could anyone pls give me a hint ?. Maybe it's in a table in the kernel ? :> > :> >I need to know this too! :> > :> :> ANSWER: man fuser : :fuser will give you the PID's which have a particular file open. [only if you should have it on your system.] : :Does anyone know of a similar facility which will list the files that :a particular process has open. If not, does anyone have any simple :suggestions on how to accomplish this task, (short of formatting the :user structure..). fstat(8), a standard utility out of the BSD release (um, 4.3 something) goes both ways. You can hand it files and learn about processes they have open, or you can hand it procs (or users) and get back files. It helps for pulling out PCB addrs on sockets, which when used with netstat(8) can sometimes be useful. It can tell you what files are open on a partition and other interesting things. I believe it's on uunet. Of course, it's pretty kernel specific. --tom -- "Still waiting to read alt.fan.dan-bernstein using DBWM, Dan's own AI window manager, which argues with you 10 weeks before resizing your window." ### And now for the question of the month: How do you spell relief? Answer: U=brnstnd@kramden.acf.nyu.edu; echo "/From: $U/h:j" >>~/News/KILL; expire -f $U