Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Apr 2003 04:29:22 +0700
From:      Alexey Dokuchaev <danfe@nsu.ru>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        arch@freebsd.org
Subject:   Re: itimerfix() fix for time validity check
Message-ID:  <20030331212922.GA53585@regency.nsu.ru>
In-Reply-To: <20030331201454.GA6000@dan.emsphone.com>
References:  <20030331174454.GA51622@regency.nsu.ru> <20030331201454.GA6000@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 31, 2003 at 02:14:54PM -0600, Dan Nelson wrote:
> 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

Thanks for clarification.
I think the issue can now be withdrawn.

> 
> > 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.

Yes, indeed, I've just checked it.

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030331212922.GA53585>