Re: detect valid fd

2014-09-15 Thread Patrick Welche
On Tue, Sep 16, 2014 at 12:51:24AM +0100, Justin Cormack wrote: On Tue, Sep 16, 2014 at 12:20 AM, Patrick Welche pr...@cam.ac.uk wrote: Given a filedescriptor, how can you tell that it is valid and has been opened? In the attached simple program, a file and a directory are opened (with

Re: detect valid fd

2014-09-15 Thread Justin Cormack
On Tue, Sep 16, 2014 at 12:59 AM, Patrick Welche pr...@cam.ac.uk wrote: So for both of you, things look correct! This is on Sunday's NetBSD 7.99.1 amd64, but this is an old problem for me... Very odd. What does ktrace output look like? Which other versions did you see this on before? Justin

Re: detect valid fd

2014-09-15 Thread Matt Thomas
On Sep 15, 2014, at 4:59 PM, Patrick Welche pr...@cam.ac.uk wrote: On Tue, Sep 16, 2014 at 12:51:24AM +0100, Justin Cormack wrote: On Tue, Sep 16, 2014 at 12:20 AM, Patrick Welche pr...@cam.ac.uk wrote: Given a filedescriptor, how can you tell that it is valid and has been opened? In the

Re: detect valid fd

2014-09-15 Thread Patrick Welche
On Mon, Sep 15, 2014 at 05:11:12PM -0700, Matt Thomas wrote: On Sep 15, 2014, at 4:59 PM, Patrick Welche pr...@cam.ac.uk wrote: On Tue, Sep 16, 2014 at 12:51:24AM +0100, Justin Cormack wrote: On Tue, Sep 16, 2014 at 12:20 AM, Patrick Welche pr...@cam.ac.uk wrote: Given a filedescriptor,

Re: detect valid fd

2014-09-15 Thread Patrick Welche
On Mon, Sep 15, 2014 at 05:11:12PM -0700, Matt Thomas wrote: On Sep 15, 2014, at 4:59 PM, Patrick Welche pr...@cam.ac.uk wrote: On Tue, Sep 16, 2014 at 12:51:24AM +0100, Justin Cormack wrote: On Tue, Sep 16, 2014 at 12:20 AM, Patrick Welche pr...@cam.ac.uk wrote: Given a filedescriptor,

Re: detect valid fd

2014-09-15 Thread Christos Zoulas
In article 20140915232046.ga9...@quark.cable.rcn.com, Patrick Welche pr...@cam.ac.uk wrote: -=-=-=-=-=- Given a filedescriptor, how can you tell that it is valid and has been opened? In the attached simple program, a file and a directory are opened (with CLOEXEC set). I then call fcntl(fd,

re: detect valid fd

2014-09-15 Thread matthew green
prlw1cloexec 2336 10 /usr 7439186 -r--r--r-- 58736 r prlw1cloexec 2336 13 /home1375614 -rw-r--r-- 18 r fd 10 is /usr/X11R7/lib/X11/fonts/TTF/VeraSeBd.ttf fd 13 is /home/prlw1/.xsmstartup looks like X has some close-on-exec problems as well. xsm is