From owner-freebsd-arch@FreeBSD.ORG Mon Mar 31 12:14:56 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2AE4E37B401 for ; Mon, 31 Mar 2003 12:14:56 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7939E43FDD for ; Mon, 31 Mar 2003 12:14:55 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h2VKEsHV057176; Mon, 31 Mar 2003 14:14:54 -0600 (CST) (envelope-from dan) Date: Mon, 31 Mar 2003 14:14:54 -0600 From: Dan Nelson To: Alexey Dokuchaev Message-ID: <20030331201454.GA6000@dan.emsphone.com> References: <20030331174454.GA51622@regency.nsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030331174454.GA51622@regency.nsu.ru> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: arch@freebsd.org Subject: Re: itimerfix() fix for time validity check X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2003 20:14:57 -0000 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