From owner-freebsd-current@FreeBSD.ORG Mon Apr 2 15:43:27 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 951CF16A408 for ; Mon, 2 Apr 2007 15:43:27 +0000 (UTC) (envelope-from faber@ISI.EDU) Received: from boreas.isi.edu (boreas.isi.edu [128.9.160.161]) by mx1.freebsd.org (Postfix) with ESMTP id 608B113C48C for ; Mon, 2 Apr 2007 15:43:27 +0000 (UTC) (envelope-from faber@ISI.EDU) Received: from hut.isi.edu (hut.isi.edu [128.9.168.160]) by boreas.isi.edu (8.13.8/8.13.8) with ESMTP id l32FXLs2007507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 2 Apr 2007 08:33:21 -0700 (PDT) Received: (from faber@localhost) by hut.isi.edu (8.13.8/8.13.8/Submit) id l32FXLSH098835 for current@freebsd.org; Mon, 2 Apr 2007 08:33:21 -0700 (PDT) (envelope-from faber) Date: Mon, 2 Apr 2007 08:33:21 -0700 From: Ted Faber To: current@freebsd.org Message-ID: <20070402153321.GC97955@hut.isi.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jousvV0MzM2p6OtC" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-url: http://www.isi.edu/~faber X-ISI-4-43-8-MailScanner: Found to be clean X-MailScanner-From: faber@hut.isi.edu Cc: Subject: Clock setting bug on current/i386 (patch available) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2007 15:43:27 -0000 --jousvV0MzM2p6OtC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi. I had a sort of wierd bug with the code in sys/i386/isa/clock.c that sets the kernel clock from the realtime clock. The short story is in=20 http://www.freebsd.org/cgi/query-pr.cgi?pr=3D111117 The longer story is that my EPIA ME6000 clock seems to have the day of the week wrong in its real time clock (RTC) and no way to adjust that value. This shouldn't be a big deal, but the code that converts from the RTC to seconds (clock_ct_to_ts() in sys/kern/subr_clock.c) checks the day of the week value - unless it's set to -1 - though it isn't used in the conversion. That code fails with an error if the day of the week is wrong. The i386 clock-setting code doesn't check this return value and the kernel time is set to whatever lucky value was on the stack when the function was called. There is much odd behavior on a box that thinks that the year is 1937. newsyslog fails to parse configuration files, for example... The PR has a few line patch to call clock_ct_to_ts() again with the day of the week set to -1 if the function fails and the day of the week wasn't -1. It prints some diagnostics to let a user know their clock isn't set should none of that work. Feel free to clip the diagnostics, but they would have saved me some time. :-) It's a short patch. I'm sending this mail in the hope that some committer will pop it in as an easy Monday morning thing. Thanks! --=20 Ted Faber http://www.isi.edu/~faber PGP: http://www.isi.edu/~faber/pubkeys.= asc Unexpected attachment on this mail? See http://www.isi.edu/~faber/FAQ.html#= SIG --jousvV0MzM2p6OtC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFGESJBaUz3f+Zf+XsRAoa0AJ0RCyIr7swIQW2G72RzQeFXtCdDxACggd19 lVNlNRZw6ICIsHY6AwTjQZ8= =lfEN -----END PGP SIGNATURE----- --jousvV0MzM2p6OtC--