Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!orion.oac.uci.edu!cedman From: cedman@golem.ps.uci.edu (Carl Edman) Newsgroups: comp.sys.hp Subject: Re: The "getdtablesize" command Message-ID: Date: 19 Dec 90 17:36:59 GMT References: <28687@mimsy.umd.edu> <4310152@hpindda.cup.hp.com> Organization: University of California, Irvine, USA. Lines: 39 Nntp-Posting-Host: lynx.ps.uci.edu In-reply-to: ash@hpindda.cup.hp.com's message of 19 Dec 90 01:45:04 GMT In article <4310152@hpindda.cup.hp.com> ash@hpindda.cup.hp.com (Art Harkin) writes: Try: #include #ifdef hpux t = FD_SETSIZE; #else /* hpux */ t = getdtablesize(); #endif /* hpux */ Art Harkin Hewlett Packard How come that _no_one_ in the world, not even HP, uses its own system call to do this ? (sysconf, a solution with which I posted a few days ago). Also this solution is, if I understand correctly, incorrect or at least wastefull. While FD_SETSIZE is guaranteed to be greater than FILENO, thus it probably wouldn't cause any harm for the most common applications, it is at least wasteful. Also imagine, e.g., an application which has a variable number of sockets open. This application has usually many low-priority connections, which can be closed at a moments notice, without any harm but must be able to accept some uncommon high-priority messages quickly. So the application closes one low-priority connection when it notices that its number of open connections approaches FILENO. Using FD_SETSIZE instead of this breaks this application. Carl Edman Theorectical Physicist,N.:A physicist whose | Send mail existence is postulated, to make the numbers | to balance but who is never actually observed | cedman@golem.ps.uci.edu in the laboratory. | edmanc@uciph0.ps.uci.edu