Results 1 to 4 of 4
Hi All,
How can I get the number of files that are kept open by a certain process at a certain time using C++ ?
I want to call the ...
- 11-19-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 43
Number of files that are kept open by a certain process
Hi All,
How can I get the number of files that are kept open by a certain process at a certain time using C++ ?
I want to call the Linux system function that provides me with that information from within C++ source code, for which the number of open files kept open by itself matters to me.
By the way, this C++ source code continuously opens up new files for writing.
Thanks.
- 11-19-2009 #2
I'm not sure whether any system calls available to fetch this detail.
But you can parse /proc/[pid]/fd to know how many files are used by the process denoted by pid.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 11-19-2009 #3Just Joined!
- Join Date
- Nov 2009
- Posts
- 3
I know the lsof command that will show open handles and the process.
- 11-19-2009 #4
thanks chris123a,Yes lsof command should work. But you need a function , then explore the source code lsof
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------


Reply With Quote