Just some simple questions to verify I'm right in my expectations:
I believe that whenever a file descriptor is opened it uses the lowest available file descriptor number, is that correct? If so, am I right in thinking I can get the maximum file descriptor number the program can ever get can be retrieved by calling getrlimit with RLIMIT_NOFILE? Because if you open exactly that many files (you can't open more), the maximum number would be RLIMIT_NOFILE.
Is this correct?
Thanks in advance