Not only the standard library does not have this funcionality, it’s not even possible in general. You could (on linux) check /proc/*/fd
— but it is possible that your program does not have permission to do it on processes from other users (this is the default in Ubuntu, for instance).