$NetBSD: patch-aa,v 1.3 2007/12/18 20:45:49 rumble Exp $
--- radeontool.c.orig	2004-02-11 05:50:27 +0200
+++ radeontool.c	2008-12-30 21:47:53 +0200
@@ -21,7 +21,19 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <sys/mman.h>
+#ifdef __NetBSD__
+#include <sys/param.h>
+#if __NetBSD_Prereq__(4,99,32)
+#include <sys/mutex.h>
+#else
+#include <sys/lock.h>
+#endif
+#include <machine/vmparam.h>
+#elif defined(__DragonFly__)
+#include <sys/param.h>
+#else /* ! __NetBSD__ */
 #include <asm/page.h>
+#endif
 
 #include "radeon_reg.h"
 
@@ -107,7 +119,7 @@ static unsigned char * map_devince_memor
         mem_fd, 
         base
     );
-    if ((long)device_mem < 0) {
+    if (device_mem == MAP_FAILED) {
         if(debug)
             fprintf(stderr,"mmap returned %d\n",(int)device_mem);
         fatal("mmap error \n");
@@ -251,7 +263,6 @@ static void map_radeon_cntl_mem(void)
     } else if(forkrc == 0) { /* if child */
         close(pipefd[0]);
         dup2(pipefd[1],1);  /* stdout */
-        setenv("PATH","/sbin:/usr/sbin:/bin:/usr/bin",1);
         execlp("lspci","lspci","-v",NULL);
         fatal("exec lspci failure\n");
     }
@@ -307,7 +318,13 @@ We need to look through it to find the s
        }
        if(debug) 
           printf("%s",line);
-       if(strstr(line,"emory") && strstr(line,"K")) {  /* if line contains a "Memory" and "K" string */
+       if(strstr(line,"emory") &&
+#ifdef __NetBSD__
+       strstr(line,"non-prefetch"))
+#else
+       strstr(line,"K"))
+#endif
+       {  /* if line contains a "Memory" and "K" string */
           break;
        }
     };
