Accept 64-bit addresses on the command line
authorproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 3 Apr 2008 03:39:24 +0000 (03:39 +0000)
committerproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 3 Apr 2008 03:39:24 +0000 (03:39 +0000)
Define _FILE_OFFSET_BITS to 64, so that even 32-bit systems would accept
64-bit addresses and pass then to mmap() correctly.  It could be useful
on systems with a 64-bit kernel and 32-bit userspace.

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3421 0192ed92-7a03-0410-a25b-9323aeb14dbd

tools/ath_info.c

index 84312f6b0ea06b2bd730e32a38f38ba8f5856171..bf28d8bee2fd099cf86d3396f11c4ef71787e43d 100644 (file)
@@ -89,6 +89,9 @@
  *
  */
 
+/* Try accepting 64-bit device address even with 32-bit userspace */
+#define _FILE_OFFSET_BITS 64
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -952,7 +955,7 @@ void sta_id0_id1_dump(void *mem)
 
 int main(int argc, char *argv[])
 {
-       u_int32_t dev_addr;
+       unsigned long long dev_addr;
        u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
        u_int16_t eeprom_version, mac_version, regdomain, has_crystal, ee_magic;
        u_int8_t error, has_a, has_b, has_g, has_rfkill, eeprom_size;
@@ -1046,7 +1049,7 @@ int main(int argc, char *argv[])
                return 3;
        }
 
-       dev_addr = strtoul(argv[anr], NULL, 16);
+       dev_addr = strtoull(argv[anr], NULL, 16);
 
        fd = open("/dev/mem", O_RDWR);
        if (fd < 0) {
@@ -1058,7 +1061,7 @@ int main(int argc, char *argv[])
                   MAP_SHARED | MAP_FILE, fd, dev_addr);
 
        if (mem == MAP_FAILED) {
-               printf("Mmap of device at 0x%08X for 0x%X bytes failed - "
+               printf("Mmap of device at 0x%08llX for 0x%X bytes failed - "
                       "%s\n", dev_addr, AR5K_PCI_MEM_SIZE, strerror(errno));
                return -3;
        }