Adjust printf format specifiers for dev_t and ino_t in user space.

ino_t and dev_t are about to become uint64_t.

Reviewed by:	kib, mckusick
This commit is contained in:
Gleb Kurtsou 2014-12-17 07:10:48 +00:00
parent 52df462f7f
commit 9b33705411
4 changed files with 39 additions and 28 deletions

View File

@ -67,6 +67,7 @@ static const char rcsid[] =
#include <fcntl.h>
#include <libufs.h>
#include <paths.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -361,7 +362,7 @@ dump_whole_ufs1_inode(ino_t inode, int level)
/*
* Dump the main inode structure.
*/
snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
if (level & 0x100) {
DBG_DUMP_INO(&sblock,
comment,
@ -385,8 +386,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0",
inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
(uintmax_t)inode);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@ -401,8 +402,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1",
inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
(uintmax_t)inode);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@ -416,7 +417,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
"Inode 0x%08jx: indirect 1->%d", (uintmax_t)inode,
ind2ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@ -432,8 +434,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2",
inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
(uintmax_t)inode);
#define SQUARE(a) ((a)*(a))
DBG_DUMP_IBLK(&sblock,
comment,
@ -450,7 +452,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
"Inode 0x%08jx: indirect 2->%d", (uintmax_t)inode,
ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@ -466,8 +469,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 2->%d->%d", inode,
ind3ctr, ind3ctr);
"Inode 0x%08jx: indirect 2->%d->%d",
(uintmax_t)inode, ind3ctr, ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i1blk,
@ -513,7 +516,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
/*
* Dump the main inode structure.
*/
snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
if (level & 0x100) {
DBG_DUMP_INO(&sblock, comment, ino);
}
@ -535,7 +538,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0", inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
(uintmax_t)inode);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}
@ -547,7 +551,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1", inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
(uintmax_t)inode);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@ -561,7 +566,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
"Inode 0x%08jx: indirect 1->%d",
(uintmax_t)inode, ind2ctr);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}
@ -574,7 +580,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
(size_t)sblock.fs_bsize) == -1) {
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2", inode);
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
(uintmax_t)inode);
#define SQUARE(a) ((a)*(a))
DBG_DUMP_IBLK(&sblock,
comment,
@ -591,7 +598,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
"Inode 0x%08jx: indirect 2->%d",
(uintmax_t)inode, ind3ctr);
DBG_DUMP_IBLK(&sblock,
comment,
i2blk,
@ -605,8 +613,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
err(1, "bread: %s", disk.d_error);
}
snprintf(comment, sizeof(comment),
"Inode 0x%08x: indirect 2->%d->%d", inode,
ind3ctr, ind3ctr);
"Inode 0x%08jx: indirect 2->%d->%d",
(uintmax_t)inode, ind3ctr, ind3ctr);
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
}

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -346,14 +347,14 @@ auditid(void)
"mask.success=0x%08x\n"
"mask.failure=0x%08x\n"
"asid=%d\n"
"termid_addr.port=0x%08x\n"
"termid_addr.port=0x%08jx\n"
"termid_addr.addr[0]=0x%08x\n"
"termid_addr.addr[1]=0x%08x\n"
"termid_addr.addr[2]=0x%08x\n"
"termid_addr.addr[3]=0x%08x\n",
ainfo_addr.ai_auid, ainfo_addr.ai_mask.am_success,
ainfo_addr.ai_mask.am_failure, ainfo_addr.ai_asid,
ainfo_addr.ai_termid.at_port,
(uintmax_t)ainfo_addr.ai_termid.at_port,
ainfo_addr.ai_termid.at_addr[0],
ainfo_addr.ai_termid.at_addr[1],
ainfo_addr.ai_termid.at_addr[2],
@ -363,11 +364,11 @@ auditid(void)
"mask.success=0x%08x\n"
"mask.failure=0x%08x\n"
"asid=%d\n"
"termid.port=0x%08x\n"
"termid.port=0x%08jx\n"
"termid.machine=0x%08x\n",
auditinfo.ai_auid, auditinfo.ai_mask.am_success,
auditinfo.ai_mask.am_failure,
auditinfo.ai_asid, auditinfo.ai_termid.port,
auditinfo.ai_asid, (uintmax_t)auditinfo.ai_termid.port,
auditinfo.ai_termid.machine);
}
}

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <dirent.h>
#include <jail.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -262,7 +263,7 @@ main(int ac, char **av)
errx(1, "%s: not a character device", buf);
tdev = sb.st_rdev;
if (dflag)
printf("ttydev:0x%x\n", tdev);
printf("ttydev:0x%jx\n", (uintmax_t)tdev);
}
if (user) {
uid = strtol(user, &ep, 10);
@ -410,8 +411,9 @@ main(int ac, char **av)
if (matched == 0)
continue;
if (dflag)
printf("sig:%d, cmd:%s, pid:%d, dev:0x%x uid:%d\n", sig,
thiscmd, thispid, thistdev, thisuid);
printf("sig:%d, cmd:%s, pid:%d, dev:0x%jx uid:%d\n",
sig, thiscmd, thispid, (uintmax_t)thistdev,
thisuid);
if (vflag || sflag)
printf("kill -%s %d\n", sys_signame[sig], thispid);

View File

@ -387,8 +387,8 @@ main(int argc, char *argv[])
continue; /* file unreasonable */
if (sflag && (cp = linked(arg)) != NULL) {
(void)snprintf(buf, sizeof(buf), "%u %ju",
statb.st_dev, (uintmax_t)statb.st_ino);
(void)snprintf(buf, sizeof(buf), "%ju %ju",
(uintmax_t)statb.st_dev, (uintmax_t)statb.st_ino);
card('S', buf);
if (format == 'p')
card('T', title ? title : arg);