Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.03; 'interpreter': 0.04; 'subject:file': 0.07; 'subject:How': 0.09; 'python': 0.09; 'aix': 0.09; 'least)': 0.09; 'portable': 0.09; 'satisfy': 0.09; '"by': 0.16; "(i'm": 0.16; '(windows': 0.16; 'descriptors': 0.16; 'fcntl': 0.16; 'optionally': 0.16; 'pipes': 0.16; 'preserved': 0.16; 'exists': 0.17; 'default,': 0.22; "i'd": 0.22; 'received:74.125.82.174': 0.23; 'seems': 0.23; 'cheers': 0.24; 'linux': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'concern': 0.29; 'locks': 0.29; 'question:': 0.29; 'them?': 0.29; 'subject:all': 0.29; "i'm": 0.29; 'knows': 0.30; '(from': 0.30; 'mode': 0.30; 'stuff': 0.30; 'expect': 0.31; 'file': 0.32; 'getting': 0.33; 'received:74.125.82': 0.33; 'solaris': 0.33; 'to:addr:python-list': 0.33; 'know.': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'needed': 0.35; 'platforms,': 0.35; 'open': 0.35; 'subject:?': 0.35; 'received:74.125': 0.36; 'test': 0.36; 'too': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'information': 0.63; 'more': 0.63; 'within': 0.64; 'subject:get': 0.81; '2.3.': 0.84; 'are...': 0.84; 'induce': 0.84; 'alone.': 0.91; 'yours.': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=nA5qgDGZcpDsl4pq3rmw8ts1WXWMhlmxd8+zNg8pvMk=; b=XsThRbwfIzXCR4Rv1HyA40YsCroT27ieZZ61kMos/Nb4aDFjXySEgO81BdLQ31/saO 1oNfBuD0Ddq6ugAM4dZcwD6pxfhSKe9FUNQaJuK2lmB6kQ0WFqxu6otIlD7YwNp6xzES bf7zQIxHVoBd1yusUgSTUf97FQsxLyMGA+rvpPUnpiPuARSBK1W6V1o2hAxZb+V6WR4P my5imgJ9geZiwvCPjk77ufoe2lzmshbkdF0vePob/4p5+y2VM9Kf2m8jExOfp+oPESnf Dr+PvItIrd7IOQVNa3C53TwxS4yRkIx11v7lnQjfwJIiBy/E7wlGuvAyBcYmHSvchsby ZoVA== MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 19 Sep 2012 15:36:02 -0500 Subject: Re: How to get the list of all my open file(descriptor)s and locks? From: =?UTF-8?Q?Ismael_Farf=C3=A1n?= To: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348086963 news.xs4all.nl 6894 [2001:888:2000:d::a6]:47886 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29527 2012/9/19 Ismael Farf=C3=A1n : > 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 --=20 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.