Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!ames!ptsfa!pacbell!tandem!narayan From: narayan@tandem.UUCP (narayan mohanram TCP/IP Conso) Newsgroups: comp.unix.wizards Subject: Re: To find out the names of open files in a process Message-ID: <339@tandem.UUCP> Date: 20 Jan 88 18:03:00 GMT References: <2346@mandrill.CWRU.Edu> Organization: Tandem Computers, Cupertino,CA-development Lines: 25 In article <2346@mandrill.CWRU.Edu>, garg@mandrill.CWRU.Edu (Dev Datt Garg) writes: > One of the features I am trying > to add is to be able to save the context of a process at any point in the > user program, so that at later stage program can be restarted from that point. > 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. The conovoluted way to do that would be to look at the inode (incore) by looking at u.u_ofile[x]->f_inode. This can then give you the major/minor device number of the file that is open (You can also get the seek pointers). You then have to search the mount table, and find where this major/minor device is mounted, and then search the file system for the necessary inode number. You can thus establish a path to the file. Alternately you can write a simple character device driver that will open a file given inode information. You can thus supply this as an ioctl to the program that can then munge the internals of the kernel data structures (XXX). Narayan Mohanram (narayan@ati.tis.llnl.gov)