Subject: Re: ElectricFence barfs on mmap
To: None <port-sparc64@netbsd.org>
From: Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
List: port-sparc64
Date: 11/07/2001 10:41:33
--+nBD6E3TurpgldQp
Content-Type: multipart/mixed; boundary="GID0FwUMdk1T2AWN"
Content-Disposition: inline
--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Okay, here is a minor arch64 fix to devel/electricfence.
The page.c patch supercedes patch-ab. Please take a look at it and
eventually commit it :-) IANA C expert, but it now looks slightly more
reasonable to me.
cc: to maintainer.
--=20
Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="page.c.patch"
Content-Transfer-Encoding: quoted-printable
--- 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 @@
=20
static caddr_t startAddr =3D (caddr_t) 0;
=20
-#if ( !defined(sgi) && !defined(_AIX) )
+#if ( !defined(sgi) && !defined(_AIX) && !(defined(BSD) && BSD >=3D 199306=
))
extern int sys_nerr;
extern char * sys_errlist[];
#endif
@@ -70,7 +71,7 @@
*/
allocation =3D (caddr_t) mmap(
startAddr
- ,(int)size
+ ,size
,PROT_READ|PROT_WRITE
,MAP_PRIVATE|MAP_ANONYMOUS
,-1
@@ -122,7 +123,7 @@
*/
allocation =3D (caddr_t) mmap(
startAddr
- ,(int)size
+ ,size
,PROT_READ|PROT_WRITE
,MAP_PRIVATE
,devZeroFd
--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tstheap.c.patch"
Content-Transfer-Encoding: quoted-printable
--- tstheap.c.orig Wed Nov 7 10:05:02 2001
+++ tstheap.c Wed Nov 7 10:31:56 2001
@@ -48,6 +48,9 @@
for ( ; count < duration; count++ ) {
void * * element =3D &pool[(int)(drand48() * POOL_SIZE)];
size_t size =3D (size_t)(drand48() * (LARGEST_BUFFER + 1));
+#ifdef __arch64__
+ size =3D size && 0xffffffff00000000;
+#endif
=20
if ( *element ) {
free( *element );
--GID0FwUMdk1T2AWN--
--+nBD6E3TurpgldQp
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (SunOS)
Comment: For info see http://www.gnupg.org
iQCVAwUBO+kBzBLpPok/0ba1AQGLBwQAq3JHiL9YfPLRCRTAe3KBZocpcpEAIEQD
8K2BgTWJa9yBm1Y27TAn80C/eMkYtgxIKPEIsAtiqkhlGGLv96qCGk/v+PKeETnz
ONhC0wtSFnuOFlFn6WtHoZ+PGfXtr8dFJApCfTWH2Qb0GAaAzVmNsou3hgrsC0JT
y7q6835tTtc=
=pt9P
-----END PGP SIGNATURE-----
--+nBD6E3TurpgldQp--