ports/87546: [fix] emulators/rtc: broken if sizeof(int)!=sizeof(long)

Simun Mikecin numisemis at yahoo.com
Sun Oct 16 21:30:22 UTC 2005


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



More information about the freebsd-ports-bugs mailing list