Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

System call to get number of open file descriptors in some process

29 views
Skip to first unread message

Alex Vinokur

unread,
Jul 2, 2012, 12:50:24 AM7/2/12
to
Hi,


Linux 2.6.18
Is there any system call to get number of open file descriptors in
some process?

Thanks

Alex Vinokur

unread,
Jul 2, 2012, 1:37:34 AM7/2/12
to
> is /proc/<pid>/fd | wc -l


But it is not system call.



Alex Vinokur

unread,
Jul 2, 2012, 2:04:59 AM7/2/12
to
ls /proc/<pid>/fd | wc -l


John Reiser

unread,
Jul 2, 2012, 11:04:26 AM7/2/12
to
>> Linux 2.6.18
>> Is there any system call to get number of open file descriptors in
>> some process?

>> ls /proc/<pid>/fd | wc -l

> But it is not system call.

No, there is no such system call. You must write the code yourself.
At the lowest level, see the manual page "man 2 getdents".
Also beware that the answer is time dependent: the answer can
change quickly (in milliseconds) by a large amount in either direction.

--

0 new messages