Subject: pkg/14493: 64-bit patches for devel/electricfence
To: None <gnats-bugs@gnats.netbsd.org>
From: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
List: netbsd-bugs
Date: 11/07/2001 13:59:45
>Number:         14493
>Category:       pkg
>Synopsis:       64-bit patches for devel/electricfence
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 07 05:01:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.5.1
>Organization:
Informatik II, RWTH Aachen
>Environment:
	
System: NetBSD menelaos 1.5Y NetBSD 1.5Y (MENELAOS) #0: Mon Nov 5 14:15:41 CET 2001 stolz@menelaos:/usr/src/sys/arch/sparc64/compile/MENELAOS sparc64


>Description:
ElectricFence is not 64-bit clean, neither the library nor the test-suite.
The fixes are however very minor and involve not stuffing 32-values into 64 variables
with all the upper bits set.
>How-To-Repeat:
On arch64, e.g. sparc64 try installing ElectricFence.
>Fix:
Note that the patch for page.c supercedes patchfile patch-ab.

--- tstheap.c.orig	Wed Nov  7 10:05:02 2001
+++ tstheap.c	Wed Nov  7 13:52:11 2001
@@ -47,7 +47,7 @@
 
 	for ( ; count < duration; count++ ) {
 		void * *	element = &pool[(int)(drand48() * POOL_SIZE)];
-		size_t		size = (size_t)(drand48() * (LARGEST_BUFFER + 1));
+		size_t		size = (size_t)(lrand48() % (LARGEST_BUFFER + 1));
 
 		if ( *element ) {
 			free( *element );

--- page.c.orig	Sat Apr 27 00:57:38 1996
+++ page.c	Wed Nov  7 10:02:04 2001
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/mman.h>
+#include <sys/param.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
@@ -29,7 +30,7 @@
 
 static caddr_t	startAddr = (caddr_t) 0;
 
-#if ( !defined(sgi) && !defined(_AIX) )
+#if ( !defined(sgi) && !defined(_AIX) && !(defined(BSD) && BSD >= 199306))
 extern int	sys_nerr;
 extern char *	sys_errlist[];
 #endif
@@ -70,7 +71,7 @@
 	 */
 	allocation = (caddr_t) mmap(
 	 startAddr
-	,(int)size
+	,size
 	,PROT_READ|PROT_WRITE
 	,MAP_PRIVATE|MAP_ANONYMOUS
 	,-1
@@ -122,7 +123,7 @@
 	 */
 	allocation = (caddr_t) mmap(
 	 startAddr
-	,(int)size
+	,size
 	,PROT_READ|PROT_WRITE
 	,MAP_PRIVATE
 	,devZeroFd
>Release-Note:
>Audit-Trail:
>Unformatted: