From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Oct 16 21:30:22 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF72316A420 for ; Sun, 16 Oct 2005 21:30:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD7B543D5F for ; Sun, 16 Oct 2005 21:30:16 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9GLUGZX006754 for ; Sun, 16 Oct 2005 21:30:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j9GLUGsX006753; Sun, 16 Oct 2005 21:30:16 GMT (envelope-from gnats) Resent-Date: Sun, 16 Oct 2005 21:30:16 GMT Resent-Message-Id: <200510162130.j9GLUGsX006753@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Simun Mikecin Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9A0016A41F for ; Sun, 16 Oct 2005 21:20:12 +0000 (GMT) (envelope-from sime@data.home.hr) Received: from data.home.hr (dh79-11.xnet.hr [83.139.79.11]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C2CC43D48 for ; Sun, 16 Oct 2005 21:20:12 +0000 (GMT) (envelope-from sime@data.home.hr) Received: by data.home.hr (Postfix, from userid 34062) id 0512360323; Sun, 16 Oct 2005 23:20:10 +0200 (CEST) Message-Id: <20051016212010.0512360323@data.home.hr> Date: Sun, 16 Oct 2005 23:20:10 +0200 (CEST) From: Simun Mikecin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: knu@idaemons.org Subject: ports/87546: [fix] emulators/rtc: broken if sizeof(int)!=sizeof(long) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Simun Mikecin List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2005 21:30:22 -0000 >Number: 87546 >Category: ports >Synopsis: [fix] emulators/rtc: broken if sizeof(int)!=sizeof(long) >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Oct 16 21:30:16 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Simun Mikecin >Release: FreeBSD 6.0-RC1 amd64 >Organization: >Environment: System: FreeBSD data.home.hr 6.0-RC1 FreeBSD 6.0-RC1 #4: Sun Oct 16 16:47:10 CEST 2005 root@:/var/obj/usr/src/sys/DATA amd64 >Description: Linux RTC interface defines that an application can read unsigned long chunks from /dev/rtc. Our implementation uses int, so it is broken on all platforms that have sizeof(long)!=sizeof(int). I corrected this. Also I added support for reading int sized values, cause it is supported in the Linux RTC implementation. >How-To-Repeat: On platform that has sizeof(int)!=sizeof(long) (eg. amd64) install emulators/rtc port. Also install multimedia/mplayer with WITH_RTC=yes. Start mplayer to watch a movie and you will see a bunch of error messages about RTC. >Fix: --- Makefile.orig Fri Oct 7 22:16:44 2005 +++ Makefile Sun Oct 16 23:08:53 2005 @@ -7,7 +7,7 @@ PORTNAME= rtc PORTVERSION= 2004.02.24.1 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= emulators linux MASTER_SITES= # none DISTFILES= # none --- files/rtc.c.orig Fri Oct 7 22:16:44 2005 +++ files/rtc.c Sun Oct 16 23:07:57 2005 @@ -82,7 +82,7 @@ struct callout rtc_handle; struct timespec lasttime; struct selinfo sip; - int woken; + unsigned long woken; void *rtc_ident; } var; }; @@ -338,11 +338,13 @@ tsleep(&sc->var.rtc_ident, PCATCH, "rtc rd", hz * 10); #if 0 if (sc->var.woken > 1) - printf("woken: %d\n", sc->var.woken); + printf("woken: %lu\n", sc->var.woken); #endif - if (uio->uio_resid == sizeof(int)) { - error = uiomove(&sc->var.woken, sizeof(int), uio); + if (uio->uio_resid == sizeof(unsigned int)) { + error = uiomove(&sc->var.woken, sizeof(unsigned int), uio); + } else if (uio->uio_resid == sizeof(unsigned long)) { + error = uiomove(&sc->var.woken, sizeof(unsigned long), uio); } sc->var.woken = 0; return error; >Release-Note: >Audit-Trail: >Unformatted: