pmap: fix compiler format warnings

pmap.c: In function 'discover_shm_minor':
pmap.c:87:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:87:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c: In function 'mapping_name':
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c: In function 'one_proc':
pmap.c:265:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:265:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c:315:11: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-02-26 00:00:11 +01:00 committed by Craig Small
parent 2347521bb5
commit bd9abebd9f

10
pmap.c
View File

@ -82,7 +82,7 @@ static void discover_shm_minor(void)
unsigned KLONG start, end; unsigned KLONG start, end;
unsigned long long file_offset, inode; unsigned long long file_offset, inode;
unsigned dev_major, dev_minor; unsigned dev_major, dev_minor;
sscanf(mapbuf, "%" KLF "x-%" KLF "x %31s %Lx %x:%x %Lu", &start, sscanf(mapbuf, "%" KLF "x-%" KLF "x %31s %llx %x:%x %llu", &start,
&end, flags, &file_offset, &dev_major, &dev_minor, &end, flags, &file_offset, &dev_major, &dev_minor,
&inode); &inode);
tmp = strchr(mapbuf, '\n'); tmp = strchr(mapbuf, '\n');
@ -125,7 +125,7 @@ static char *mapping_name(proc_t * p, unsigned KLONG addr,
if (!dev_major && dev_minor == shm_minor && strstr(mapbuf, "/SYSV")) { if (!dev_major && dev_minor == shm_minor && strstr(mapbuf, "/SYSV")) {
static char shmbuf[64]; static char shmbuf[64];
snprintf(shmbuf, sizeof shmbuf, " [ shmid=0x%Lx ]", inode); snprintf(shmbuf, sizeof shmbuf, " [ shmid=0x%llx ]", inode);
return shmbuf; return shmbuf;
} }
@ -260,7 +260,7 @@ static int one_proc(proc_t * p)
continue; continue;
} }
} }
sscanf(mapbuf, "%" KLF "x-%" KLF "x %31s %Lx %x:%x %Lu", &start, sscanf(mapbuf, "%" KLF "x-%" KLF "x %31s %llx %x:%x %llu", &start,
&end, flags, &file_offset, &dev_major, &dev_minor, &end, flags, &file_offset, &dev_major, &dev_minor,
&inode); &inode);
@ -308,8 +308,8 @@ static int one_proc(proc_t * p)
mapping_name(p, start, diff, mapbuf, 0, dev_major, mapping_name(p, start, diff, mapbuf, 0, dev_major,
dev_minor, inode); dev_minor, inode);
printf((sizeof(KLONG) == 8) printf((sizeof(KLONG) == 8)
? "%016" KLF "x %7lu %s %016Lx %03x:%05x %s\n" ? "%016" KLF "x %7lu %s %016llx %03x:%05x %s\n"
: "%08lx %7lu %s %016Lx %03x:%05x %s\n", : "%08lx %7lu %s %016llx %03x:%05x %s\n",
start, start,
(unsigned long)(diff >> 10), (unsigned long)(diff >> 10),
flags, file_offset, dev_major, dev_minor, cp); flags, file_offset, dev_major, dev_minor, cp);