Home » Questions » Computers [ Ask a new question ]

Meaning of FDSize in /proc/PID/status

Meaning of FDSize in /proc/PID/status

I'm looking for a way to find out the open FD limit under Ubuntu machines which doesn't have the /proc/PID/limits, namely EC2 machines.

Asked by: Guest | Views: 478
Total answers/comments: 2
Guest [Entry]

"No, it does not show the limit - just the usage.

>>> import resource
>>> resource.setrlimit(resource.RLIMIT_NOFILE, (10000, 10000))
>>> resource.getrlimit(resource.RLIMIT_NOFILE)
(10000, 10000)

Now:

>>> for i in range(5000):
... f=open('/tmp/delme'+str(i),'w')
... fs.append(f)

And:

laptop:/proc/20160$ cat status
...
FDSize: 8192
...

The value wasn't changed after changing the limit, just after creating the files. It means that it measures the actual usage, not the limits."
Guest [Entry]

from man proc, "* FDSize: Number of file descriptor slots currently allocated.", this is the number of "struct file" in the file descriptor table of a process.