*BSD News Article 5826


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!sgiblab!spool.mu.edu!decwrl!decwrl!amdcad!BitBlocks.com!bvs
From: bvs@BitBlocks.com (Bakul Shah)
Subject: Re: getdtablesize
Message-ID: <BvEJKJ.LAJ@BitBlocks.com>
Organization: Bit Blocks, Inc.
References: <tlukka.717504312@vipunen.hut.fi> <Bv7Dz7.C2o@BitBlocks.com> <1992Sep29.142535.21001@nntp.hut.fi>
Date: Wed, 30 Sep 1992 17:36:18 GMT
Lines: 25

alo@kampi.hut.fi (Antti Louko) writes:

>In article <Bv7Dz7.C2o@BitBlocks.com> bvs@BitBlocks.com (Bakul Shah) writes:

>>Now I don't think what zsh is doing is wrong.  The problem is in
>>the use of getdtablesize() in popen() and the code above.  What is
>>needed is a system call that returns the highest *open* file
>>descriptor number.

>Actually, an even better solution is to have a system call

>getdescriptors(firstfd,dtable,dtablesize)

>int	firstfd;
>int	dtable[];
>int	*dtablesize;

There is a simpler solution for what popen() does but either of the
proposed syscall will handle cases where all (or all but a select
few) open file descriptors are closed.  On the other hand, your
syscall can be used to avoid any unnecessary close() calls, which
matters when open file descriptors are *not* all bunched together
near 0 as is usually the case.

Bakul Shah <bvs@BitBlocks.com>