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

Discussion in 'Python' started by Ismael Farfán, Sep 19, 2012.

  1. 2012/9/19 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?
    >
    >
    > 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.
    >
    > From a standalone test within the interpreter I'd expect to get (at
    > least) std(in/out/err).
    >
    > If more information is needed in order to help me, please let me know.
    >
    > Cheers
    > Ismael
    >
    >
    > --
    > Do not let me induce you to satisfy my curiosity, from an expectation,
    > that I shall gratify yours. What I may judge proper to conceal, does
    > not concern myself alone.


    It seems like I can use os.fstat to find out if a fd exists and also
    get it's type and mode (I'm getting some pipes too : )

    I hope it's portable across platforms, if someone knows a better
    solution please let me know.

    Ismael



    --
    Do not let me induce you to satisfy my curiosity, from an expectation,
    that I shall gratify yours. What I may judge proper to conceal, does
    not concern myself alone.
    Ismael Farfán, 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:
    207
    Ismael Farfán
    Sep 19, 2012
  2. Ian Kelly
    Replies:
    0
    Views:
    229
    Ian Kelly
    Sep 19, 2012
  3. Ian Kelly
    Replies:
    0
    Views:
    229
    Ian Kelly
    Sep 19, 2012
  4. Ismael Farfán
    Replies:
    0
    Views:
    234
    Ismael Farfán
    Sep 19, 2012
  5. Chris Angelico
    Replies:
    1
    Views:
    284
    Hans Mulder
    Sep 20, 2012
Loading...

Share This Page