I don't know how to get the limit but I do know how to get the count of handles currently in use. I am using the C library that java sigar employs. I can get the number of file handles a process uses by calling sigar_proc_fd_get. The structure this fills in has a member total, which is the file handle count.

Regards,

Andrew Marlow



Internet  
sigar-users@hyperic.org

Sent by: sigar-users-bounces@springsource.com

16/03/2011 15:13
Please respond to
sigar-users@hyperic.org

To
sigar-users@hyperic.org
cc
Subject
Obtaining maximum configured open file descriptors of the current user





Hi,

I want to obtain the maximum available open file descriptors of the current user in a linux OS using sigar (ulimit -n).

I tried using the Ulimit class but it seems to provide me with the hard limit which is I think the machine maximum configured open file descriptors and not the current user. If I ran ulimit -n in shell I get a different number then what sigar is showing (a lower number) and I need the result to be the ulimit -n which is the soft limit (current user limit). Obviously I want this to be cross OS as much as possible otherwise I would not be using Sigar.

I also looked at Sigar.getResourceLimit().getOpenFilesCur() and getOpenFileMax() but it also returns the hard limit.

Additionally, is there any other way to obtain the currently used open file descriptors of the current user in one command other then going over all the existing processes pids in a loop and accumulating sigar.getProcFd(pid).getTotal() ?

Thanks
Eitan


___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-845C5H  for additional disclosures.