NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/44950: fcntl(F_MAXFD) returns bogus values



On May 14,  2:33pm, david%l8s.co.uk@localhost (David Laight) wrote:
-- Subject: Re: kern/44950: fcntl(F_MAXFD) returns bogus values

| On Wed, May 11, 2011 at 12:55:01PM +0000, Christos Zoulas wrote:
| >  .... Note that
| >  you cannot depend on what file descriptors the shell may have open. Just to
| >  give an example, if you do an NIS operation you end up with a file 
descriptor
| >  open.
| 
| I fairly sure that the shell command line redirects have to refer to
| file 0 through 9 in an exec'd child process - so those can't be used
| for other purposes.
| 
| I did think that that the shell shouldn't really leave anything else open.

It depends on the shell. Bourne-like shells generally leave things alone,
where csh descendents make sure that everything above 2 is closed and
internally they use 16, 17, 18 for stdin, stdout, stderr so that they
don't have to play games with 0, 1, 2 each time they execute something.

christos


Home | Main Index | Thread Index | Old Index