From: torvalds@klaava.Helsinki.FI (Linus Torvalds) Subject: Re: select() ? Date: Thu, 11 Feb 1993 14:12:54 GMT
In article <1lbpfv$b6g@smurf.sub.org> urlichs@smurf.sub.org (Matthias Urlichs) writes:
>
>Why does select() change the timeout (last argument)?
The reason is very simple: I had never even used select() when I
originally implemented it (based on patches by pmacdona, I believe,
although they got "slightly" edited), and the only source of information
on select() I had was the SunOS manual pages. If you look closely (and I
did), you'll see something like this in the BUGS section:
select() should probably return the time remaining from the
original timeout, if any, by modifying the time value in
place. This may be implemented in future versions of the
system. Thus, it is unwise to assume that the timeout
pointer will be unmodified by the select() call.
As this was pointed out as a bug in the SunOS implementation, I
naturally went for the correct behaviour, and only later learned that
nobody else seem to do this :-)
As it is, I think the current linux behaviour is the correct one, and I
think the timeout problems in the libraries have been fixed (look for
libc.a.4.3 in the near future). I won't change the behaviour: if
anybody really wants the "normal" behaviour, you can easily make a dummy
select() call which copies the values around to an internal buffer
before calling the system call... I'd prefer it if programs were
re-written not to count on the current SunOS "bugs", in which case
they'll work correctly under linux.
Linus