pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/radeontool radeontool: use sysconf(3) instead...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e4262afe7114
branches:  trunk
changeset: 383763:e4262afe7114
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Mon Aug 22 17:23:36 2022 +0000

description:
radeontool: use sysconf(3) instead of non-portable PAGE_SIZE macro

diffstat:

 sysutils/radeontool/distinfo         |   4 +-
 sysutils/radeontool/patches/patch-aa |  60 ++++++++++++++++++++++++------------
 2 files changed, 42 insertions(+), 22 deletions(-)

diffs (103 lines):

diff -r baeadffd3b4f -r e4262afe7114 sysutils/radeontool/distinfo
--- a/sysutils/radeontool/distinfo      Mon Aug 22 15:33:32 2022 +0000
+++ b/sysutils/radeontool/distinfo      Mon Aug 22 17:23:36 2022 +0000
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.9 2021/10/26 11:20:06 nia Exp $
+$NetBSD: distinfo,v 1.10 2022/08/22 17:23:36 tnn Exp $
 
 BLAKE2s (radeontool-1.5.tar.gz) = c70fac965e396cedaabc4313f1b572dd0881b5099cd9b4f70dd7c5ca0df78145
 SHA512 (radeontool-1.5.tar.gz) = 985771cbaff3d6451563ac388b6b303410b7e1088c9a7404de63964c465f3708f9fede40fde7dfeaeb3779dff86a9007fcf982cced23cdc2f6bdd555494f78aa
 Size (radeontool-1.5.tar.gz) = 20869 bytes
-SHA1 (patch-aa) = b2b765131bfcb22eb0e5082d529fb0f01644a9a3
+SHA1 (patch-aa) = 827c065b171910640435bf722002c3b1034ec8da
diff -r baeadffd3b4f -r e4262afe7114 sysutils/radeontool/patches/patch-aa
--- a/sysutils/radeontool/patches/patch-aa      Mon Aug 22 15:33:32 2022 +0000
+++ b/sysutils/radeontool/patches/patch-aa      Mon Aug 22 17:23:36 2022 +0000
@@ -1,27 +1,36 @@
-$NetBSD: patch-aa,v 1.4 2008/12/30 20:25:54 hasso Exp $
---- radeontool.c.orig  2004-02-11 05:50:27 +0200
-+++ radeontool.c       2008-12-30 21:47:53 +0200
-@@ -21,7 +21,19 @@
+$NetBSD: patch-aa,v 1.5 2022/08/22 17:23:36 tnn Exp $
+--- radeontool.c.orig  2004-02-11 03:50:27.000000000 +0000
++++ radeontool.c
+@@ -21,12 +21,12 @@
  #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 <asm/page.h>
  
  #include "radeon_reg.h"
  
-@@ -107,7 +119,7 @@ static unsigned char * map_devince_memor
+ int debug;
+ int skip;
++long page_size;
+ 
+ /* *radeon_cntl_mem is mapped to the actual device's memory mapped control area. */
+ /* Not the address but what it points to is volatile. */
+@@ -94,11 +94,11 @@ static unsigned char * map_devince_memor
+     }
+ 
+     /* mmap graphics memory */
+-    if ((device_mem = malloc(length + (PAGE_SIZE-1))) == NULL) {
++    if ((device_mem = malloc(length + (page_size-1))) == NULL) {
+         fatal("allocation error \n");
+     }
+-    if ((unsigned long)device_mem % PAGE_SIZE)
+-        device_mem += PAGE_SIZE - ((unsigned long)device_mem % PAGE_SIZE);
++    if ((unsigned long)device_mem % page_size)
++        device_mem += page_size - ((unsigned long)device_mem % page_size);
+     device_mem = (unsigned char *)mmap(
+         (caddr_t)device_mem, 
+         length,
+@@ -107,7 +107,7 @@ static unsigned char * map_devince_memor
          mem_fd, 
          base
      );
@@ -30,7 +39,7 @@
          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)
+@@ -251,7 +251,6 @@ static void map_radeon_cntl_mem(void)
      } else if(forkrc == 0) { /* if child */
          close(pipefd[0]);
          dup2(pipefd[1],1);  /* stdout */
@@ -38,7 +47,7 @@
          execlp("lspci","lspci","-v",NULL);
          fatal("exec lspci failure\n");
      }
-@@ -307,7 +318,13 @@ We need to look through it to find the s
+@@ -307,7 +306,13 @@ We need to look through it to find the s
         }
         if(debug) 
            printf("%s",line);
@@ -53,3 +62,14 @@
            break;
         }
      };
+@@ -321,6 +326,10 @@ We need to look through it to find the s
+ 
+ int main(int argc,char *argv[]) 
+ {
++    if ((page_size = sysconf(_SC_PAGESIZE)) == -1) {
++        fatal("sysconf failed\n");
++    }
++    
+     if(argc == 1) {
+         map_radeon_cntl_mem();
+       usage();



Home | Main Index | Thread Index | Old Index