Xref: utzoo comp.unix.wizards:19759 comp.unix.questions:18426 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!dogie.macc.wisc.edu!uwvax!umn-d-ub!umn-cs!nis!pwcs!minnow!lee From: lee@minnow.sp.unisys.com (Gene Lee) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: : ** PROGRAM TO LIST FILES CURRENTLY OPEN BY A PROCESS ** Message-ID: <1546@minnow.sp.unisys.com> Date: 12 Dec 89 15:12:57 GMT Organization: Unisys Corporation, Roseville, MN Lines: 27 I am trying to write a program (on UNIX 5.2) which will list the files which are currently open by a process. I started to investigate the problem and got as far as reading the proc structure out of the /dev/kmem. Thats where I get stuck. I know that I need to read the user structure for the process but how do I find it? Is there a pointer of somekind in structure proc that I am overlooking. Once I can read the user structure then I will be able to get a list of the open file slots used by the program. This will give me the inodes of the open files which I can then convert to filenames. Please mail responses to me. Its easy to overlook things in the heavy traffic. Thanks in advance. Gene W. Lee Gene Lee UUCP: ...!pyramid!pwcs!minnow!lee Unisys Corporation ...!amdahl!ems!minnow!lee Phone: (612) 635-7147 CSNET: lee@minnow.SP.Unisys.Com If not for the courage of the fearless manager, the paycheck would be lost.