Is there a way to tell through /proc or something else which files a process has open and more importantly what position the read pointer is in for that open file? As an example if I am reading a file with a program I have no control over, and I kill that program, I need to know when in the data file that program was reading at that time. Is this information available and if so how to read it? Thanks, Jerry
>>> sender: "Jerry Geis" date: "Mon, Oct 03, 2005 at 10:49:09PM -0500" <<<EOQ > Is there a way to tell through /proc or something else which > files a process has open and more importantly what position the read > pointer is in for that open file?man lsof <- for the list of files opened by a program man strace <- to take a peak at what the program is doing Have a nice day everyone, Alex
On 10/3/05, Jerry Geis <geisj at pagestation.com> wrote:> > Is there a way to tell through /proc or something else which > files a process has open and more importantly what position the read > pointer is in for that open file? > > As an example if I am reading a file with a program I have no control > over, > and I kill that program, I need to know when in the data file that > program was > reading at that time. > > Is this information available and if so how to read it?ls -l /proc/$pid/fd Cheers...james Thanks,> > Jerry > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20051004/2fdaf42b/attachment-0002.html>
Alex, I did something simple; on one window did more/etc/mail/sendmail.cf on another window did lsof -o -b -p XXX -w where XXX is hte process number and the SIZE column does not change to OFFSET! the size reflects the size of sendmail.cf - I was hoping the "-o" would change the SIZE column to OFFSET column and show at what offset the program has read into the file? AM I doing something wrong? THanks so much. Jerry>>>/ sender: "Jerry Geis" date: "Mon, Oct 03, 2005 at 10:49:09PM -0500" <<<EOQ/>/ Is there a way to tell through /proc or something else which />/ files a process has open and more importantly what position the read />/ pointer is in for that open file? /man lsof <- for the list of files opened by a program man strace <- to take a peak at what the program is doing Have a nice day everyone, Alex