Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'linux,': 0.05; 'aix,': 0.07; 'subject:file': 0.07; 'subject:How': 0.09; 'python': 0.09; 'aix': 0.09; 'sep': 0.09; 'solaris,': 0.09; '(windows': 0.16; 'optionally': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'obviously': 0.18; 'linux': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'question:': 0.29; 'them?': 0.29; 'subject:all': 0.29; "i'm": 0.29; '(from': 0.30; 'stuff': 0.30; 'could': 0.32; 'solaris': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'too': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'more': 0.63; 'within': 0.64; 'subject:get': 0.81; '2.3.': 0.84; 'to:name:python': 0.84; 'do:': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=fYZXv68fh9HDbgleVIxCKBJb1JRhRlr0+b53RBHVd/0=; b=XPj9j37TGlqMu6xMGA7nR8LdgiQxpz3Xdglb9mMpim9c8J6+aWf8uRa+AP3E7XGwgx 6jXS+d19WssUPdRaATYIcj4MhmFqN3VrQLskdbJ2jDWbUsheiyODZF9nztn1rekU/zqx lL+Zd6gTYX59Dybc/O1pLeRaiHj+DZ1Hh4bPmAWr55uHpQiVDKxmdoBr0z4SaC+kskHm IudvYYSd1AuFOiJRkdDr7ycZP8ntVosf4TugSCMVtFHSjZBi6xjnsKBXdNIkuPpJIEs1 G2NR6zxGx9jacXYO61Elz5pCJFRqVIwOHEzxYhc1z6qHmP849ZgC4Mq4sVgtNumKgKux w6wg== MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Wed, 19 Sep 2012 15:09:47 -0600 Subject: Re: How to get the list of all my open file(descriptor)s and locks? To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348089019 news.xs4all.nl 6912 [2001:888:2000:d::a6]:52311 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29528 On Wed, Sep 19, 2012 at 11:34 AM, Ismael Farf=E1n wro= te: > 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.