diff options
author | Ed Schouten <ed@FreeBSD.org> | 2012-01-17 22:17:10 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2012-01-17 22:17:10 +0000 |
commit | 6aed20fe1ae1f1ba4232fd0a5d561fe44960095c (patch) | |
tree | bbebdb6cae5f1648b706a39e3ee8c67266993728 /bin/ps/print.c | |
parent | 5c952e8d1b913e94338efa8815ea74f34f0215e3 (diff) | |
download | src-6aed20fe1ae1f1ba4232fd0a5d561fe44960095c.tar.gz src-6aed20fe1ae1f1ba4232fd0a5d561fe44960095c.zip |
Remove unused variables.
Simply annotate the function parameters with __unused, instead of adding
the ve-variables. This makes the code build with GCC 4.7 and -Werror.
Notes
Notes:
svn path=/head/; revision=230287
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r-- | bin/ps/print.c | 126 |
1 files changed, 30 insertions, 96 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 021415f8b7d3..5c9398d63514 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -99,10 +99,8 @@ printheader(void) char * arguments(KINFO *k, VARENT *ve) { - VAR *v; char *vis_args; - v = ve->var; if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL) errx(1, "malloc failed"); strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH); @@ -116,10 +114,8 @@ arguments(KINFO *k, VARENT *ve) char * command(KINFO *k, VARENT *ve) { - VAR *v; char *vis_args, *vis_env, *str; - v = ve->var; if (cflag) { /* If it is the last field, then don't pad */ if (STAILQ_NEXT(ve, next_ve) == NULL) { @@ -172,10 +168,8 @@ command(KINFO *k, VARENT *ve) char * ucomm(KINFO *k, VARENT *ve) { - VAR *v; char *str; - v = ve->var; if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */ asprintf(&str, "%s%s%s%s", k->ki_d.prefix ? k->ki_d.prefix : "", @@ -192,12 +186,10 @@ ucomm(KINFO *k, VARENT *ve) } char * -tdnam(KINFO *k, VARENT *ve) +tdnam(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; if (showthreads && k->ki_p->ki_numthreads > 1) str = strdup(k->ki_p->ki_tdname); else @@ -207,28 +199,24 @@ tdnam(KINFO *k, VARENT *ve) } char * -logname(KINFO *k, VARENT *ve) +logname(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; if (*k->ki_p->ki_login == '\0') return (NULL); return (strdup(k->ki_p->ki_login)); } char * -state(KINFO *k, VARENT *ve) +state(KINFO *k, VARENT *ve __unused) { int flag, tdflags; char *cp, *buf; - VAR *v; buf = malloc(16); if (buf == NULL) errx(1, "malloc failed"); - v = ve->var; flag = k->ki_p->ki_flag; tdflags = k->ki_p->ki_tdflags; /* XXXKSE */ cp = buf; @@ -294,72 +282,58 @@ state(KINFO *k, VARENT *ve) #define scalepri(x) ((x) - PZERO) char * -pri(KINFO *k, VARENT *ve) +pri(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_level)); return (str); } char * -upr(KINFO *k, VARENT *ve) +upr(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%d", scalepri(k->ki_p->ki_pri.pri_user)); return (str); } #undef scalepri char * -uname(KINFO *k, VARENT *ve) +uname(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; return (strdup(user_from_uid(k->ki_p->ki_uid, 0))); } char * -egroupname(KINFO *k, VARENT *ve) +egroupname(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; return (strdup(group_from_gid(k->ki_p->ki_groups[0], 0))); } char * -rgroupname(KINFO *k, VARENT *ve) +rgroupname(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; return (strdup(group_from_gid(k->ki_p->ki_rgid, 0))); } char * -runame(KINFO *k, VARENT *ve) +runame(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; return (strdup(user_from_uid(k->ki_p->ki_ruid, 0))); } char * -tdev(KINFO *k, VARENT *ve) +tdev(KINFO *k, VARENT *ve __unused) { - VAR *v; dev_t dev; char *str; - v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV) str = strdup("-"); @@ -370,13 +344,11 @@ tdev(KINFO *k, VARENT *ve) } char * -tname(KINFO *k, VARENT *ve) +tname(KINFO *k, VARENT *ve __unused) { - VAR *v; dev_t dev; char *ttname, *str; - v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) str = strdup("- "); @@ -394,13 +366,11 @@ tname(KINFO *k, VARENT *ve) } char * -longtname(KINFO *k, VARENT *ve) +longtname(KINFO *k, VARENT *ve __unused) { - VAR *v; dev_t dev; const char *ttname; - v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) ttname = "-"; @@ -409,9 +379,8 @@ longtname(KINFO *k, VARENT *ve) } char * -started(KINFO *k, VARENT *ve) +started(KINFO *k, VARENT *ve __unused) { - VAR *v; time_t then; struct tm *tp; static int use_ampm = -1; @@ -422,7 +391,6 @@ started(KINFO *k, VARENT *ve) if (buf == NULL) errx(1, "malloc failed"); - v = ve->var; if (!k->ki_valid) return (NULL); if (use_ampm < 0) @@ -441,9 +409,8 @@ started(KINFO *k, VARENT *ve) } char * -lstarted(KINFO *k, VARENT *ve) +lstarted(KINFO *k, VARENT *ve __unused) { - VAR *v; time_t then; char *buf; size_t buflen = 100; @@ -452,7 +419,6 @@ lstarted(KINFO *k, VARENT *ve) if (buf == NULL) errx(1, "malloc failed"); - v = ve->var; if (!k->ki_valid) return (NULL); then = k->ki_p->ki_start.tv_sec; @@ -461,12 +427,10 @@ lstarted(KINFO *k, VARENT *ve) } char * -lockname(KINFO *k, VARENT *ve) +lockname(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) { if (k->ki_p->ki_lockname[0] != 0) str = strdup(k->ki_p->ki_lockname); @@ -479,12 +443,10 @@ lockname(KINFO *k, VARENT *ve) } char * -wchan(KINFO *k, VARENT *ve) +wchan(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; if (k->ki_p->ki_wchan) { if (k->ki_p->ki_wmesg[0] != 0) str = strdup(k->ki_p->ki_wmesg); @@ -497,12 +459,10 @@ wchan(KINFO *k, VARENT *ve) } char * -nwchan(KINFO *k, VARENT *ve) +nwchan(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; if (k->ki_p->ki_wchan) asprintf(&str, "%0lx", (long)k->ki_p->ki_wchan); else @@ -512,12 +472,10 @@ nwchan(KINFO *k, VARENT *ve) } char * -mwchan(KINFO *k, VARENT *ve) +mwchan(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; if (k->ki_p->ki_wchan) { if (k->ki_p->ki_wmesg[0] != 0) str = strdup(k->ki_p->ki_wmesg); @@ -535,27 +493,23 @@ mwchan(KINFO *k, VARENT *ve) } char * -vsize(KINFO *k, VARENT *ve) +vsize(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%lu", (u_long)(k->ki_p->ki_size / 1024)); return (str); } static char * -printtime(KINFO *k, VARENT *ve, long secs, long psecs) +printtime(KINFO *k, VARENT *ve __unused, long secs, long psecs) /* psecs is "parts" of a second. first micro, then centi */ { - VAR *v; static char decimal_point; char *str; if (decimal_point == '\0') decimal_point = localeconv()->decimal_point[0]; - v = ve->var; if (!k->ki_valid) { secs = 0; psecs = 0; @@ -618,14 +572,12 @@ usertime(KINFO *k, VARENT *ve) } char * -elapsed(KINFO *k, VARENT *ve) +elapsed(KINFO *k, VARENT *ve __unused) { - VAR *v; time_t val; int days, hours, mins, secs; char *str; - v = ve->var; if (!k->ki_valid) return (NULL); val = now - k->ki_p->ki_start.tv_sec; @@ -646,13 +598,11 @@ elapsed(KINFO *k, VARENT *ve) } char * -elapseds(KINFO *k, VARENT *ve) +elapseds(KINFO *k, VARENT *ve __unused) { - VAR *v; time_t val; char *str; - v = ve->var; if (!k->ki_valid) return (NULL); val = now - k->ki_p->ki_start.tv_sec; @@ -682,12 +632,10 @@ getpcpu(const KINFO *k) } char * -pcpu(KINFO *k, VARENT *ve) +pcpu(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%.1f", getpcpu(k)); return (str); } @@ -712,47 +660,39 @@ getpmem(KINFO *k) } char * -pmem(KINFO *k, VARENT *ve) +pmem(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%.1f", getpmem(k)); return (str); } char * -pagein(KINFO *k, VARENT *ve) +pagein(KINFO *k, VARENT *ve __unused) { - VAR *v; char *str; - v = ve->var; asprintf(&str, "%ld", k->ki_valid ? k->ki_p->ki_rusage.ru_majflt : 0); return (str); } /* ARGSUSED */ char * -maxrss(KINFO *k __unused, VARENT *ve) +maxrss(KINFO *k __unused, VARENT *ve __unused) { - VAR *v; - v = ve->var; /* XXX not yet */ return (NULL); } char * -priorityr(KINFO *k, VARENT *ve) +priorityr(KINFO *k, VARENT *ve __unused) { - VAR *v; struct priority *lpri; char *str; unsigned class, level; - v = ve->var; lpri = &k->ki_p->ki_pri; class = lpri->pri_class; level = lpri->pri_level; @@ -852,25 +792,21 @@ rvar(KINFO *k, VARENT *ve) } char * -emulname(KINFO *k, VARENT *ve) +emulname(KINFO *k, VARENT *ve __unused) { - VAR *v; - v = ve->var; if (k->ki_p->ki_emul == NULL) return (NULL); return (strdup(k->ki_p->ki_emul)); } char * -label(KINFO *k, VARENT *ve) +label(KINFO *k, VARENT *ve __unused) { char *string; - VAR *v; mac_t proclabel; int error; - v = ve->var; string = NULL; if (mac_prepare_process_label(&proclabel) == -1) { warn("mac_prepare_process_label"); @@ -887,12 +823,10 @@ out: } char * -loginclass(KINFO *k, VARENT *ve) +loginclass(KINFO *k, VARENT *ve __unused) { - VAR *v; char *s; - v = ve->var; /* * Don't display login class for system processes; * login classes are used for resource limits, |