From owner-freebsd-questions Wed Jun 19 02:51:13 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id CAA01593 for questions-outgoing; Wed, 19 Jun 1996 02:51:13 -0700 (PDT) Received: from jraynard.demon.co.uk (jraynard.demon.co.uk [158.152.42.77]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id CAA01473 for ; Wed, 19 Jun 1996 02:50:19 -0700 (PDT) Received: (from fqueries@localhost) by jraynard.demon.co.uk (8.7.5/8.6.12) id AAA00949; Wed, 19 Jun 1996 00:16:39 GMT Date: Wed, 19 Jun 1996 00:16:39 GMT Message-Id: <199606190016.AAA00949@jraynard.demon.co.uk> From: James Raynard To: trig@netlink.co.uk CC: questions@FreeBSD.ORG In-reply-to: (trig@netlink.co.uk) Subject: Re: Max first parameter of a Select call? Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > How do you get the 'select' call in FreeBSD to be happy with something > greater than 256 as a first parameter? The first argument to select() specifies the highest-numbered file descriptor you want select() to check, plus 1. For example, if you want select() to examine file descriptors 3, 7 and 14, you would have to pass 15 as the first argument. (A common error is to assume that the first argument is how many descriptors you want checked - it isn't!) > Anything above this seems to give a "Select error 22 - invalid argument" As the select() man page explains, things will not work properly if the first argument is greater than FD_SETSIZE, which is 256 by default. Hence the EINVAL error. In any case, the number of file descriptors a process can have open is limited by OPEN_MAX, which is 64 on FreeBSD:- $ cat temp.c #include #include int main() { printf("The size of the descriptor table is %d.\n", getdtablesize()); return 0; } $ gcc temp.c $ ./a.out The size of the descriptor table is 64. $ -- James Raynard, Edinburgh, Scotland james@jraynard.demon.co.uk