[1190] in linux-net channel archive
Re: select: strange behaviour
daemon@ATHENA.MIT.EDU (Perry F Nguyen)
Tue Oct 10 06:58:00 1995
Date: Mon, 9 Oct 1995 15:44:53 -0700 (PDT)
From: Perry F Nguyen <pfnguyen@netcom22.netcom.com>
Reply-To: pfnguyen@netcom.com
To: Norbert Thies <norbert@taz.de>
cc: linux-net@vger.rutgers.edu
In-Reply-To: <Pine.SV4.3.91.951009093146.23127A-100000@mogli>
On Mon, 9 Oct 1995, Norbert Thies wrote:
> After the timeout has expired, tv.tv_sec == 0,
> ie. the value of 'tv' has been changed in 'select'.
> Since all other *IX systems I tried, do preserve
> the original value it breaks code (actually: archie-1.4.1).
> Do you consider this behaviour a feature or is it a bug?
It's a feature :-), try reading the man page:
NOTES
Some code calls select with all three sets empty, n zero,
and a non-null timeout as a fairly portable way to sleep
with subsecond precision.
On Linux, timeout is modified to reflect the amount of
time not slept; most other implementations do not do this.
This causes problems both when Linux code which reads
timeout is ported to other operating systems, and when
code is ported to Linux that reuses a struct timeval for
multiple selects in a loop without reinitializing it.
Consider timeout to be undefined after select returns.
--
pub 1024/0D97E00D 1995/01/01 Perry "Huy" Francis Nguyen
Key fingerprint = CE 62 F2 01 33 87 9D 89 BC 53 8D 11 F9 A0 DE 8F
<pfnguyen@netcom.com> - FTP ftp://ftp.netcom.com/pub/pf/pfn
FTP or finger pfnguyen@netcom.com for PGP Public Key.