summaryrefslogtreecommitdiffstats
path: root/usr.bin/top
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-01-13 08:24:41 +0000
committerngie <ngie@FreeBSD.org>2017-01-13 08:24:41 +0000
commit1439c045a5980d4b47875d2684ce906726227638 (patch)
treeadf94822a18db21271c268753b2712957ca58c11 /usr.bin/top
parent19829ae67eebd9ffbe08e6cffcb63ed4e5d59568 (diff)
downloadFreeBSD-src-1439c045a5980d4b47875d2684ce906726227638.zip
FreeBSD-src-1439c045a5980d4b47875d2684ce906726227638.tar.gz
MFC r266773,r280680,r311710:
r266773 (by jhb): Fix a couple of size_t != int warnings. r280680 (by kevlo): Print size_t's with %zu rather than "%zd. r311710: Style fixes - Delete trailing whitespace - Use nitems(mib) instead of hardcoding the mib length
Diffstat (limited to 'usr.bin/top')
-rw-r--r--usr.bin/top/machine.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 6978060..f247d95 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -363,7 +363,7 @@ machine_init(struct statics *statics, char do_unames)
size = sizeof(long) * maxcpu * CPUSTATES;
times = malloc(size);
if (times == NULL)
- err(1, "malloc %zd bytes", size);
+ err(1, "malloc %zu bytes", size);
if (sysctlbyname("kern.cp_times", times, &size, NULL, 0) == -1)
err(1, "sysctlbyname kern.cp_times");
pcpu_cp_time = calloc(1, size);
@@ -396,7 +396,7 @@ format_header(char *uname_field)
{
static char Header[128];
const char *prehead;
-
+
if (ps.jail)
jidlength = TOP_JID_LEN + 1; /* +1 for extra left space. */
else
@@ -536,7 +536,7 @@ get_system_info(struct system_info *si)
arc_stats[5] = arc_stat >> 10;
si->arc = arc_stats;
}
-
+
/* set arrays and strings */
if (pcpu_stats) {
si->cpustates = pcpu_cpu_states;
@@ -562,7 +562,7 @@ get_system_info(struct system_info *si)
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
size = sizeof(boottime);
- if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
+ if (sysctl(mib, nitems(mib), &boottime, &size, NULL, 0) != -1 &&
boottime.tv_sec != 0) {
si->boottime = boottime;
} else {
@@ -917,7 +917,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
argbuflen = cmdlen * 4;
argbuf = (char *)malloc(argbuflen + 1);
if (argbuf == NULL) {
- warn("malloc(%d)", argbuflen + 1);
+ warn("malloc(%zu)", argbuflen + 1);
free(cmdbuf);
return NULL;
}
@@ -970,7 +970,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
}
}
- if (ps.jail == 0)
+ if (ps.jail == 0)
jid_buf[0] = '\0';
else
snprintf(jid_buf, sizeof(jid_buf), "%*d",
@@ -1026,7 +1026,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
thr_buf[0] = '\0';
else
snprintf(thr_buf, sizeof(thr_buf), "%*d ",
- sizeof(thr_buf) - 2, pp->ki_numthreads);
+ (int)(sizeof(thr_buf) - 2), pp->ki_numthreads);
snprintf(fmt, sizeof(fmt), proc_fmt,
pp->ki_pid,
OpenPOWER on IntegriCloud