Date: Mon, 31 Mar 2003 14:14:54 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Alexey Dokuchaev <danfe@regency.nsu.ru> Cc: arch@freebsd.org Subject: Re: itimerfix() fix for time validity check Message-ID: <20030331201454.GA6000@dan.emsphone.com> In-Reply-To: <20030331174454.GA51622@regency.nsu.ru> References: <20030331174454.GA51622@regency.nsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 01), Alexey Dokuchaev said: > While porting some apps written for Linux to FreeBSD, I've > encountered the fact that, while under Linux it's quite appropriate > (and possible) to pass million and more milliseconds as tv_usec value > in > > struct timeval { > long tv_sec; > long tv_usec; > }; > > used in functions like setitimer(), it's not like that in FreeBSD. > > Brief investigation showed that itimerfix() treats tv_usec >= 1000000 > invalid. On contrary, Linux recalculates the values (and eventually, > tv_usec is indeed less than 1000000. Then it is violating the SUSV3/POSIX 1003.1-2001 standard: The setitimer() function shall fail if: [EINVAL] The value argument is not in canonical form. (In canonical form, the number of microseconds is a non-negative integer less than 1000000 and the number of seconds is a non-negative integer.) Free registration to access the standard is at http://www.unix.org/online.html > Since I'm unaware of what does any particular standard say on this > issue, but since the dominant number of apps are being written (and > designed) for Linux, this seems to cause run-time compatibility problem; > quite a few apps in out ports collection might need special patching. Those programs will also fail on Solaris, which fails on invalid timeval values. -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030331201454.GA6000>