Messages in this thread | | | From | (H. Peter Anvin) | Subject | Re: File Descriptors & Linux 2.0 | Date | 27 Jun 1996 03:44:53 GMT |
| |
Followup to: <4qs1aq$4qv@picard.cistron.nl> By author: miquels@cistron.nl (Miquel van Smoorenburg) In newsgroup: linux.dev.kernel > > I just checked the Linux-2.0.0 kernel and the sys_select function never > writes further in your fd_set than the nr_fds argument to select(). This > means that if NR_OPEN is increased, and the size of fd_set increases with it, > it doesn't have consequences for older applications. The only thing is that > an old application can't handle a fd > 255 in a select() if one is passed > through fork()/exec() but I know of no applications that do this. So I think > you can do this without trouble. > > If it's the other way around, and you try to pass a nr_fds > NR_OPEN to > select() the kernel sys_select function will round it down to NR_OPEN > quietly. So that doesn't cause trouble either. > > Somehow I get the feeling that sys_select() was coded with this already > in mind.. >
How many applications do you know that actually check if the file descriptor they get from the kernel is in the range 0 <= fd < NR_OPEN? Most apps just use FD_SET() without any further checking.
-hpa -- PGP public key available - finger hpa@zytor.com I don't work for Yggdrasil, but they sponsor the linux.* hierarchy. "The earth is but one country, and mankind its citizens." -- Bahá'u'lláh Just Say No to Morden * Save Babylon 5: http://www.babylon5.com/cmp/support/
| |