Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90857 > unrolled thread

Re: fork/exec & close file descriptors

Started bySkip Montanaro <skip.montanaro@gmail.com>
First post2015-05-19 09:31 -0500
Last post2015-05-20 12:30 -0600
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: fork/exec & close file descriptors Skip Montanaro <skip.montanaro@gmail.com> - 2015-05-19 09:31 -0500
    Re: fork/exec & close file descriptors Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-05-20 13:10 +1200
      Re: fork/exec & close file descriptors Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-20 12:30 -0600

#90857 — Re: fork/exec & close file descriptors

FromSkip Montanaro <skip.montanaro@gmail.com>
Date2015-05-19 09:31 -0500
SubjectRe: fork/exec & close file descriptors
Message-ID<mailman.139.1432045882.17265.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On Tue, May 19, 2015 at 8:54 AM, Chris Angelico <rosuav@gmail.com> 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).

Skip

[toc] | [next] | [standalone]


#90907

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2015-05-20 13:10 +1200
Message-ID<cs258eFnssnU1@mid.individual.net>
In reply to#90857
> On Tue, May 19, 2015 at 8:54 AM, Chris Angelico <rosuav@gmail.com 
> <mailto:rosuav@gmail.com>> wrote:
> 
>     On Linux (and possibly some other Unixes), /proc/self/fd may be of
>     use.

On MacOSX, /dev/fd seems to be the equivalent of this.

-- 
Greg

[toc] | [prev] | [next] | [standalone]


#90973

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-05-20 12:30 -0600
Message-ID<mailman.180.1432146694.17265.python-list@python.org>
In reply to#90907
On Tue, May 19, 2015 at 7:10 PM, Gregory Ewing
<greg.ewing@canterbury.ac.nz> wrote:
>> On Tue, May 19, 2015 at 8:54 AM, Chris Angelico <rosuav@gmail.com
>> <mailto:rosuav@gmail.com>> wrote:
>>
>>     On Linux (and possibly some other Unixes), /proc/self/fd may be of
>>     use.
>
>
> On MacOSX, /dev/fd seems to be the equivalent of this.

Not a perfect equivalent. On Linux, ls -lF /proc/self/fd shows the
contents as symlinks, which is handy since you can just read the links
to see what they're pointing to. On OSX, ls -lF /dev/fd shows three
ttys and two directories.

Though I also note that on my Ubuntu Trusty system, /dev/fd is itself
a symlink to /proc/self/fd.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web