Date: Wed, 22 May 1996 15:02:14 +0200 (MET DST) From: Kees Jan Koster <dutchman@spase.nl> To: freebsd-hackers@FreeBSD.ORG (FreeBSD hackers Mailing list) Subject: Forgiving select() call. Message-ID: <199605221302.PAA00484@phobos.spase.nl>
next in thread | raw e-mail | index | archive | help
Hoi Hackers, Consider the following excerpt from /sys/kern/sys_generic.c, from 2.1.0-release. Somewhere near line 550. This piece of code forgives programs that specify a too large `nd' value by setting it to a more acceptable value. ... if (uap->nd > p->p_fd->fd_nfiles) uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */ ... Out of curiosity I printed the process ID's of processes that were forgiven in this way. One of the biggest offenders was the X server %-). My questions: - shouldn't programs that are forgiven be patched to specify correct values? - If I were to hack my kernel to return EINVAL instead, would that be a correct (if pedantic) thing to do? - I noticed that EINVAL is also returned if (uap->nd > FD_SETSIZE), why is that not forgiven. Why does the select(2) manual page not mention this. I want to modify select(2) to return the `timeout left' as described in the BUGS section of the manual page. Any reason why I should not? I have only the 2.1.0-release source tree. Has select() been modified a lot since then? Groetjes, Kees Jan ======================================================================v== Kees Jan Koster e-mail: dutchman@spase.nl Van Somerenstraat 50 tel: NL-24-3234708 6521 BS Nijmegen the Netherlands ========================================================================= Who is this general Failure and why is he reading my disk? (anonymous) =========================================================================
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605221302.PAA00484>