How to get the list of all my open file(descriptor)s and locks?

Christian Heimes christian at python.org
Wed Sep 19 20:39:42 EDT 2012


Am 19.09.2012 19:34, schrieb Ismael Farfán:
> Hello list
> 
> From man 2 EXECVE
> "By default, file descriptors remain open across an execve()"
> 
> And from man 2 FCNTL
> "Record locks are... preserved across an execve(2)."
> 
> So the question:
> * If I execve a python script (from C), how can I retrieve the list of
> files, and optionally the list of locks, from within the execve(d)
> python process so that I can use them?

Have a look at psutil:

http://code.google.com/p/psutil/#Process_management

Christian




More information about the Python-list mailing list