Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1348101907; bh=TZs87TXG7rrZ2KaYkSuc6Bikcl0z1AGgFFh+XSF1Ifw=; h=To:From:Subject:Date:Message-ID:References:Mime-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To; b=FbD3+uczNiP9Sqi09iwF8UGaZppSnsatTexe86DChLeFKz4AtURa0voHT4poHuzuj tj68PvBwTJwXB6zxtCuoKLC30ZgEWXqX0xTLBDVkK/XS0A+IQgGi3fdKfA83pUk2nI A0h9vJpUg4cpidD8jv0HwG5bUaT5JDj7qTsw1wBw= X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:file': 0.07; 'subject:How': 0.09; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"by': 0.16; 'descriptors': 0.16; 'fcntl': 0.16; 'from:name:christian heimes': 0.16; 'optionally': 0.16; 'preserved': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'from:addr:python.org': 0.17; 'default,': 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'subject:list': 0.28; 'locks': 0.29; 'question:': 0.29; 'them?': 0.29; 'subject:all': 0.29; 'url:code': 0.29; '(from': 0.30; 'file': 0.32; 'to:addr:python-list': 0.33; 'christian': 0.34; 'list': 0.35; 'open': 0.35; 'subject:?': 0.35; 'received:org': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'url:p': 0.63; 'within': 0.64; 'subject:get': 0.81; 'are...': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Christian Heimes Subject: Re: How to get the list of all my open file(descriptor)s and locks? Date: Thu, 20 Sep 2012 02:39:42 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: f049112037.adsl.alicedsl.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 In-Reply-To: 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348101909 news.xs4all.nl 6880 [2001:888:2000:d::a6]:50526 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29533 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