Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.05; 'subject:file': 0.07; 'skip:/ 10': 0.09; 'cc:addr:python-list': 0.11; 'descriptors': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'linux).': 0.16; 'magic': 0.16; 'symlink': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'appears': 0.22; 'cc:addr:python.org': 0.22; 'entries': 0.24; 'skip': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'subject:/': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'usually': 0.31; 'file': 0.32; 'open': 0.33; 'linux': 0.33; 'point.': 0.35; 'received:google.com': 0.35; 'use.': 0.39; '20,': 0.68; 'subject: & ': 0.68; '2015': 0.84; 'to:none': 0.92 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:cc :content-type; bh=uEOHikzGhTiLGUo2/mfohJRyAfSBdUoQnDdNAPUYpyA=; b=J2dHC28PoDkszfQOxPpb18pAKV5eEOiKCvVnDuzLBh0JFsEPH/kSxDjVmMDPcylatS uallGaI03Ddq1U2SvT2ucZSLZWK2qdVumyWxavBHhIZwUeiWOc5SIYfEYWl623ZuZhqA 3Q8YnpnMu9gEkAhEGuoX2/o9tVoGhszHdlP0eQxrUxTTHAW8U7YkfqYzyU8JxsUkL2il AaPglwxQDFi7YhSTpWthfRVB00H9Q0r0ouIRsuOdl/UimLTnVHQCiEKfgip0/I5ZmVif A7yWf2SbQdibGUd5ZbBcdemyY2xAelDinvUyT0gAIibNbpmdwdRUQrFS3iM6a4ptlTuN zaqQ== MIME-Version: 1.0 X-Received: by 10.50.141.164 with SMTP id rp4mr22269839igb.2.1432048429749; Tue, 19 May 2015 08:13:49 -0700 (PDT) In-Reply-To: References: Date: Wed, 20 May 2015 01:13:49 +1000 Subject: Re: fork/exec & close file descriptors From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432048432 news.xs4all.nl 2856 [2001:888:2000:d::a6]:40673 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90861 On Wed, May 20, 2015 at 12:31 AM, Skip Montanaro wrote: > On Tue, May 19, 2015 at 8:54 AM, Chris Angelico wrote: >> >> On Linux (and possibly some other Unixes), /proc/self/fd may be of >> use. > > > Good point. Yes, /proc/PID/fd appears to contain all the entries for open > file descriptors (I am on Linux). Yes, and /proc/self is usually a magic symlink to /proc/ so you can just look at /proc/self/fd instead of explicitly calling up your own PID. ChrisA