Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Dec 2014 07:10:49 +0000 (UTC)
From:      Gleb Kurtsou <gleb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r275855 - in head: sbin/ffsinfo usr.bin/id usr.bin/killall usr.sbin/lpr/lpr
Message-ID:  <201412170710.sBH7AndY003302@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gleb
Date: Wed Dec 17 07:10:48 2014
New Revision: 275855
URL: https://svnweb.freebsd.org/changeset/base/275855

Log:
  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

Modified:
  head/sbin/ffsinfo/ffsinfo.c
  head/usr.bin/id/id.c
  head/usr.bin/killall/killall.c
  head/usr.sbin/lpr/lpr/lpr.c

Modified: head/sbin/ffsinfo/ffsinfo.c
==============================================================================
--- head/sbin/ffsinfo/ffsinfo.c	Wed Dec 17 06:59:47 2014	(r275854)
+++ head/sbin/ffsinfo/ffsinfo.c	Wed Dec 17 07:10:48 2014	(r275855)
@@ -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 l
 	/*
 	 * 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 l
 			(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 l
 			(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 l
 				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 l
 			(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 l
 				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 l
 					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 l
 	/*
 	 * 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 l
 			(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 l
 			(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 l
 				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 l
 			(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 l
 				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 l
 					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));
 			}

Modified: head/usr.bin/id/id.c
==============================================================================
--- head/usr.bin/id/id.c	Wed Dec 17 06:59:47 2014	(r275854)
+++ head/usr.bin/id/id.c	Wed Dec 17 07:10:48 2014	(r275855)
@@ -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);
 	}
 }

Modified: head/usr.bin/killall/killall.c
==============================================================================
--- head/usr.bin/killall/killall.c	Wed Dec 17 06:59:47 2014	(r275854)
+++ head/usr.bin/killall/killall.c	Wed Dec 17 07:10:48 2014	(r275855)
@@ -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);

Modified: head/usr.sbin/lpr/lpr/lpr.c
==============================================================================
--- head/usr.sbin/lpr/lpr/lpr.c	Wed Dec 17 06:59:47 2014	(r275854)
+++ head/usr.sbin/lpr/lpr/lpr.c	Wed Dec 17 07:10:48 2014	(r275855)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412170710.sBH7AndY003302>