Be aware that SC_OPEN_MAX could be a very large number. For example, I've seen the Apache
module portion of the subversion server get very slow because it does this. I would
definitely advocate first trying the /proc/self method, and only falling back to SC_OPEN_MAX
if there's no alternative.