Date: Sat, 6 Feb 2010 16:01:39 +0000 (UTC) From: Jaakko Heinonen <jh@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r203551 - head/usr.bin/kdump Message-ID: <201002061601.o16G1dYx070861@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jh Date: Sat Feb 6 16:01:38 2010 New Revision: 203551 URL: http://svn.freebsd.org/changeset/base/203551 Log: - 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 MFC after: 2 weeks Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Sat Feb 6 15:32:42 2010 (r203550) +++ head/usr.bin/kdump/kdump.c Sat Feb 6 16:01:38 2010 (r203551) @@ -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 { @@ -1267,7 +1270,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); @@ -1279,7 +1282,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); @@ -1291,7 +1294,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); @@ -1303,7 +1306,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002061601.o16G1dYx070861>