Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!husc6!bbn!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.unix.wizards Subject: Re: To find out the names of open files in a process Summary: It can't really be done Message-ID: <307@fig.bbn.com> Date: 21 Jan 88 14:10:46 GMT References: <2346@mandrill.CWRU.Edu> <339@tandem.UUCP> Reply-To: rsalz@fig.bbn.com (Rich Salz) Organization: BBN Laboratories, Cambridge MA Lines: 18 >In article <2346@mandrill.CWRU.Edu>, garg@mandrill.CWRU.Edu (Dev Datt Garg) writes: > I have got some success in doing that. I am having a problem, If the program, > which I am debugging has some files open. I am unable to know which files were > open, so that the status of those files can be restored. In the general case you can't do it. For example: char *p = "/tmp/mail1234"; freopen(p, "r", stdin); unlink(p); ... (I've got some highly useful programs that do this.) If you can get the major/minor device numbers, you can rummage around to find the inode, then work back from that, but all this was hashed out here about six months ago and the conclusion was: good luck, you won't get them all. /r$ -- For comp.sources.unix stuff, mail to sources@uunet.uu.net.