From owner-freebsd-hackers Wed May 22 06:46:34 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id GAA27374 for hackers-outgoing; Wed, 22 May 1996 06:46:34 -0700 (PDT) Received: from ns.NL.net (ns.NL.net [193.78.240.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id GAA27347 for ; Wed, 22 May 1996 06:46:15 -0700 (PDT) Received: from spase by ns.NL.net via EUnet id AA14107 (5.65b/CWI-3.3); Wed, 22 May 1996 15:05:18 +0200 Received: from phobos.spase.nl (phobos [192.9.200.238]) by mercurius.spase.nl (8.6.11/8.6.11) with ESMTP id PAA17755 for ; Wed, 22 May 1996 15:01:21 +0200 From: Kees Jan Koster Received: (dutchman@localhost) by phobos.spase.nl (8.6.12/8.6.11) id PAA00484 for freebsd-hackers@FreeBSD.ORG; Wed, 22 May 1996 15:02:15 +0200 Message-Id: <199605221302.PAA00484@phobos.spase.nl> Subject: Forgiving select() call. To: freebsd-hackers@FreeBSD.ORG (FreeBSD hackers Mailing list) Date: Wed, 22 May 1996 15:02:14 +0200 (MET DST) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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) =========================================================================