Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Mar 1996 20:20:50 +0200 (UKR)
From:      "Igor A. Serikov" <igor@turtle.kiev.ua>
To:        FreeBSD bugs <bugs@freebsd.org>
Cc:        FreeBSD hackers <freebsd-hackers@freebsd.org>
Subject:   A question concerning select(2)
Message-ID:  <bVhYWGlg@turtle.kiev.ua>

next in thread | raw e-mail | index | archive | help

    Dear developers,

 Let me ask you a quetion concerning select(2).

  As I know each task has its own set of file descriptors. The size of file
descriptors table depends on the maxfilesperproc system parameter which may be
changed dynamically using sysctl system call. The system looks for an unused
slot in this table when handling such calls as open, create, accept and so
on. Then it accesses a free descriptor with the lowest number.
  Go ahead. The man page claims:

>     int
>     select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
>	     struct timeval *timeout)
>....
>   The first nfds descriptors are checked in each set; i.e., the descriptors
> from 0 through nfds-1 in the descriptor sets are examined.
>....
>   The descriptor sets are stored as bit fields in arrays of integers.  The
> following macros are provided for manipulating such descriptor sets:
> FD_ZERO(&fdsetx) initializes a descriptor set fdset to the null set.
> FD_SET(fd, &fdset) includes a particular descriptor fd in fdset.
> FD_CLR(fd, &fdset) removes fd from fdset. FD_ISSET(fd, &fdset) is non-
> zero if fd is a member of fdset, zero otherwise.  The behavior of these
> macros is undefined if a descriptor value is less than zero or greater
> than or equal to FD_SETSIZE, which is normally at least equal to the max-
> imum number of descriptors supported by the system.^^^^^^^^^^

  The point is that I can increase maxfilesperproc but  cannot change
FD_SETSIZE dynamically because the constant is hardcoded into the kernel
and the implementation of select system call disallows to overrun it,
and so I can get a descriptor which cannot be used by select.

  Am I wrong ?

--

Igor A. Serikov at home.
Kiev, Ukraine.
Email: igor@turtle.kiev.ua




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bVhYWGlg>