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.
|