From 7006778174ecaa964c89b527704e3f59ce7d1000 Mon Sep 17 00:00:00 2001 From: proski Date: Thu, 3 Apr 2008 03:39:24 +0000 Subject: [PATCH] Accept 64-bit addresses on the command line 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ath_info.c b/tools/ath_info.c index 84312f6..bf28d8b 100644 --- a/tools/ath_info.c +++ b/tools/ath_info.c @@ -89,6 +89,9 @@ * */ +/* Try accepting 64-bit device address even with 32-bit userspace */ +#define _FILE_OFFSET_BITS 64 + #include #include #include @@ -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; } -- 2.35.1