Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-15-2015, 02:58 AM   #1
Registered: Jul 2014
Posts: 43

Rep: Reputation: Disabled
Process file descriptor soft limit

I am checking process file descriptor limit using :-

count = lsof <pid> | wc -l

and then finding the usage% by count/soft_limit*100

where soft_limit is found using

cat /proc/<pid>/limits
Limit Soft Limit Hard Limit Units

Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 131072 131072 processes
Max open files 8000 8000 files
Max locked memory 65536 65536 bytes

So, my doubt is whether above command gives Max limit of open files or any other way to get it i.e which lsof lists

Last edited by gaurav_s; 01-15-2015 at 03:02 AM.
Old 01-15-2015, 06:30 AM   #2
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,890
Blog Entries: 13

Rep: Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934
lsof lists open files and I do not believe it will operate with the argument of a PID as you've shown, check the manual page for it. Basically IMHO it will list all open files belonging to all processes unless you specify options to reduce that to be "per a user", or "per type", and not sure if PID is an option for it, but maybe it is, just not how you've shown the command above.

Therefore, "/proc/<pid>/limits" is correct. Also you can use "ulimit -a" to get a more brief report on what your process limits are.

This just exploration, or you looking for a particular reason? And the reason I'm asking is because this either matters for your knowledge, a script, or a program; and there are different methods if you're programming. For instance there are setrlimit(), getrlimit(), and prlimit() for a C/C++ program. However if you're in a script then you'd use the limits file which applies to your process ID, or the one you care to check out.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to set open file descriptor hard and soft limits Z038 Slackware 3 06-16-2013 11:37 PM
Too many file open - How can we define Max limit of file descriptor janeshb Linux - Server 11 09-29-2009 10:41 AM
Increasing file descriptor limit thetawaverider Linux - General 2 02-16-2006 09:10 PM
File Descriptor Limit rbd Linux - General 3 10-11-2004 01:57 PM
Descriptor limit for a process akuate Linux - General 0 08-18-2004 11:23 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration