svn commit: r204169 - stable/8/usr.bin/kdump

Jaakko Heinonen jh at FreeBSD.org
Sun Feb 21 13:17:36 UTC 2010


Author: jh
Date: Sun Feb 21 13:17:35 2010
New Revision: 204169
URL: http://svn.freebsd.org/changeset/base/204169

Log:
  MFC r203551:
  
  - Cast intptr_t, pid_t and time_t values to intmax_t and use %jd with
    printf.
  - Cast the system call return value to long and use %ld in a printf in
    ktrsysret().
  
  PR:		bin/123774

Modified:
  stable/8/usr.bin/kdump/kdump.c
Directory Properties:
  stable/8/usr.bin/kdump/   (props changed)

Modified: stable/8/usr.bin/kdump/kdump.c
==============================================================================
--- stable/8/usr.bin/kdump/kdump.c	Sun Feb 21 11:22:01 2010	(r204168)
+++ stable/8/usr.bin/kdump/kdump.c	Sun Feb 21 13:17:35 2010	(r204169)
@@ -182,14 +182,16 @@ main(int argc, char *argv[])
 		if (ktr_header.ktr_type & KTR_DROP) {
 			ktr_header.ktr_type &= ~KTR_DROP;
 			if (!drop_logged && threads) {
-				(void)printf("%6d %6d %-8.*s Events dropped.\n",
-				    ktr_header.ktr_pid, ktr_header.ktr_tid >
-				    0 ? ktr_header.ktr_tid : 0, MAXCOMLEN,
-				    ktr_header.ktr_comm);
+				(void)printf(
+				    "%6jd %6jd %-8.*s Events dropped.\n",
+				    (intmax_t)ktr_header.ktr_pid,
+				    ktr_header.ktr_tid > 0 ?
+				    (intmax_t)ktr_header.ktr_tid : 0,
+				    MAXCOMLEN, ktr_header.ktr_comm);
 				drop_logged = 1;
 			} else if (!drop_logged) {
-				(void)printf("%6d %-8.*s Events dropped.\n",
-				    ktr_header.ktr_pid, MAXCOMLEN,
+				(void)printf("%6jd %-8.*s Events dropped.\n",
+				    (intmax_t)ktr_header.ktr_pid, MAXCOMLEN,
 				    ktr_header.ktr_comm);
 				drop_logged = 1;
 			}
@@ -309,10 +311,11 @@ dumpheader(struct ktr_header *kth)
 	 * negative tid's as 0.
 	 */
 	if (threads)
-		(void)printf("%6d %6d %-8.*s ", kth->ktr_pid, kth->ktr_tid >
-		    0 ? kth->ktr_tid : 0, MAXCOMLEN, kth->ktr_comm);
+		(void)printf("%6jd %6jd %-8.*s ", (intmax_t)kth->ktr_pid,
+		    kth->ktr_tid > 0 ? (intmax_t)kth->ktr_tid : 0,
+		    MAXCOMLEN, kth->ktr_comm);
 	else
-		(void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN,
+		(void)printf("%6jd %-8.*s ", (intmax_t)kth->ktr_pid, MAXCOMLEN,
 		    kth->ktr_comm);
 	if (timestamp) {
 		if (timestamp == 3) {
@@ -325,8 +328,8 @@ dumpheader(struct ktr_header *kth)
 			timevalsub(&kth->ktr_time, &prevtime);
 			prevtime = temp;
 		}
-		(void)printf("%ld.%06ld ",
-		    kth->ktr_time.tv_sec, kth->ktr_time.tv_usec);
+		(void)printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
+		    kth->ktr_time.tv_usec);
 	}
 	(void)printf("%s  ", type);
 }
@@ -821,7 +824,7 @@ ktrsysret(struct ktr_sysret *ktr)
 
 	if (error == 0) {
 		if (fancy) {
-			(void)printf("%d", ret);
+			(void)printf("%ld", (long)ret);
 			if (ret < 0 || ret > 9)
 				(void)printf("/%#lx", (long)ret);
 		} else {
@@ -1270,7 +1273,7 @@ ktrstat(struct stat *statp)
 	printf("rdev=%ju, ", (uintmax_t)statp->st_rdev);
 	printf("atime=");
 	if (resolv == 0)
-		printf("%ld", statp->st_atimespec.tv_sec);
+		printf("%jd", (intmax_t)statp->st_atimespec.tv_sec);
 	else {
 		tm = localtime(&statp->st_atimespec.tv_sec);
 		(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
@@ -1282,7 +1285,7 @@ ktrstat(struct stat *statp)
 		printf(", ");
 	printf("stime=");
 	if (resolv == 0)
-		printf("%ld", statp->st_mtimespec.tv_sec);
+		printf("%jd", (intmax_t)statp->st_mtimespec.tv_sec);
 	else {
 		tm = localtime(&statp->st_mtimespec.tv_sec);
 		(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
@@ -1294,7 +1297,7 @@ ktrstat(struct stat *statp)
 		printf(", ");
 	printf("ctime=");
 	if (resolv == 0)
-		printf("%ld", statp->st_ctimespec.tv_sec);
+		printf("%jd", (intmax_t)statp->st_ctimespec.tv_sec);
 	else {
 		tm = localtime(&statp->st_ctimespec.tv_sec);
 		(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);
@@ -1306,7 +1309,7 @@ ktrstat(struct stat *statp)
 		printf(", ");
 	printf("birthtime=");
 	if (resolv == 0)
-		printf("%ld", statp->st_birthtimespec.tv_sec);
+		printf("%jd", (intmax_t)statp->st_birthtimespec.tv_sec);
 	else {
 		tm = localtime(&statp->st_birthtimespec.tv_sec);
 		(void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm);


More information about the svn-src-all mailing list