Re: Poor kernel handling of invalid select() timeout
Cameron Simpson (cs@zip.com.au)
7 Dec 1998 00:19:35 -0000
On 6 Dec 1998, in message <slrn76jmft.oik.egnor@ofb.net>
egnor@ofb.net (Dan Egnor) wrote:
| struct timeval tv;
| tv.tv_sec = 0;
| tv.tv_usec = -100000;
| printf("select => %d\n",select(0,NULL,NULL,NULL,&tv));
[...]
| This is trivially fixed, but I'm not sure what the correct behavior is with
| a negative timeout value. Presumably one of the following should happen:
| 1. select() fails with EINVAL
| 2. select() succeeds, returning immediately (as with a 0 timeout)
| The Linux select() man page says nothing about this case, but only documents
| EINVAL for a negative FD count. The Unix98 spec documents EINVAL in case of
| "invalid timeout value" but doesn't specify what that means. The wording for
| timeout behavior could be interpreted as allowing negative timeouts (they
| would just expire immediately).
Surely if tv_usec <0 || tv_usec >= 1000000 then EINVAL should issue?
(And, frankly, if tv_sec < 0.) Surely anything else is simply insane?
--
Cameron Simpson, DoD#743 cs@zip.com.au http://www.zip.com.au/~cs/
Lady, have you ever seen a cat skeleton in a tree? - Kevin Dunn
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/