Operating System - HP-UX
1826314 Members
3749 Online
109692 Solutions
New Discussion

Re: How to know the open files of a process

 
Fernando_4
New Member

How to know the open files of a process

I am trying to write a C program to reveal the opened files of a given process. I was using the pstat_getfile function but the second step function pstat_getfiledetails, shown in the link below, lacks in my /usr/include/sys/pstat.h.
What can I do ?

http://docs.hp.com/cgi-bin/otsearch/getfile?top=/hpux/onlinedocs/B2355-90693/B2355-90693_top.html&id=/hpux/onlinedocs/B2355-90693/00/01/140-con.html&searchterms=pstat_getfile
fcmts
2 REPLIES 2
Tim Malnati
Honored Contributor

Re: How to know the open files of a process

Instead of trying to reinvent the wheel why not just use some tried and true PD code instead. The source for lsof is available on the Porting and Archive Center at the following link: http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.51 Just take what you want and leave the rest.
Fernando_4
New Member

Re: How to know the open files of a process

I tried the lsof and it is really good ! But my application would do other things and I would like to add those functions of lsof to my programming. How could I do that ?
fcmts