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

Discussion in 'Python' started by Ian Kelly, Sep 19, 2012.

  1. Ian Kelly

    Ian Kelly Guest

    On Wed, Sep 19, 2012 at 11:34 AM, Ismael Farfán <> wrote:
    > 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?
    >
    >
    > Some more info:
    > I'm working with exotic stuff like AIX and Solaris 10 (Windows and
    > linux too :) and my lowest common denominator is python 2.3.


    You could do:

    os.listdir("/proc/%d/fd" % os.getpid())

    This should work on Linux, AIX, and Solaris, but obviously not on Windows.
     
    Ian Kelly, Sep 19, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ismael Farfán
    Replies:
    0
    Views:
    237
    Ismael Farfán
    Sep 19, 2012
  2. Ismael Farfán
    Replies:
    0
    Views:
    229
    Ismael Farfán
    Sep 19, 2012
  3. Ian Kelly
    Replies:
    0
    Views:
    249
    Ian Kelly
    Sep 19, 2012
  4. Ismael Farfán
    Replies:
    0
    Views:
    258
    Ismael Farfán
    Sep 19, 2012
  5. Chris Angelico
    Replies:
    1
    Views:
    308
    Hans Mulder
    Sep 20, 2012
Loading...

Share This Page