summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-04-12 20:10:15 +0000
committertrasz <trasz@FreeBSD.org>2011-04-12 20:10:15 +0000
commit205b535d3e5cf7fefc69336d661902202d34d3f3 (patch)
tree377262c381456946960d6336a42d1e8e25ee056c /bin
parent8dd5170ed6669a28c48c7b913e1d0a969c66b6c6 (diff)
downloadFreeBSD-src-205b535d3e5cf7fefc69336d661902202d34d3f3.zip
FreeBSD-src-205b535d3e5cf7fefc69336d661902202d34d3f3.tar.gz
Get rid of DSIZ; instead just call the sizing function if provided.
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/keyword.c22
-rw-r--r--bin/ps/ps.c6
-rw-r--r--bin/ps/ps.h3
3 files changed, 15 insertions, 16 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index f0c0ca3..136d084 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -79,9 +79,9 @@ static VAR var[] = {
CHAR, NULL, 0},
{"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
- {"class", "CLASS", NULL, LJUST|DSIZ, loginclass, s_loginclass,
+ {"class", "CLASS", NULL, LJUST, loginclass, s_loginclass,
MAXLOGNAME-1, 0, CHAR, NULL, 0},
- {"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm,
+ {"comm", "COMMAND", NULL, LJUST, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
CHAR, NULL, 0},
@@ -103,12 +103,12 @@ static VAR var[] = {
0},
{"ktrace", "KTRACE", NULL, 0, kvar, NULL, 8, KOFF(ki_traceflag), INT,
"x", 0},
- {"label", "LABEL", NULL, LJUST|DSIZ, label, s_label, SHRT_MAX, 0, CHAR,
+ {"label", "LABEL", NULL, LJUST, label, s_label, SHRT_MAX, 0, CHAR,
NULL, 0},
{"lim", "LIM", NULL, 0, maxrss, NULL, 5, 0, CHAR, NULL, 0},
{"lockname", "LOCK", NULL, LJUST, lockname, NULL, 6, 0, CHAR, NULL,
0},
- {"login", "LOGIN", NULL, LJUST|DSIZ, logname, s_logname, MAXLOGNAME-1,
+ {"login", "LOGIN", NULL, LJUST, logname, s_logname, MAXLOGNAME-1,
0, CHAR, NULL, 0},
{"logname", "", "login", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"lstart", "STARTED", NULL, LJUST|USER, lstarted, NULL, 28, 0, CHAR,
@@ -160,14 +160,14 @@ static VAR var[] = {
0},
{"rgid", "RGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_rgid),
UINT, UIDFMT, 0},
- {"rgroup", "RGROUP", NULL, LJUST|DSIZ, rgroupname, s_rgroupname,
+ {"rgroup", "RGROUP", NULL, LJUST, rgroupname, s_rgroupname,
USERLEN, 0, CHAR, NULL, 0},
{"rss", "RSS", NULL, 0, kvar, NULL, 6, KOFF(ki_rssize), PGTOK, "ld", 0},
{"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR,
NULL, 0},
{"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid),
UINT, UIDFMT, 0},
- {"ruser", "RUSER", NULL, LJUST|DSIZ, runame, s_runame, USERLEN,
+ {"ruser", "RUSER", NULL, LJUST, runame, s_runame, USERLEN,
0, CHAR, NULL, 0},
{"sid", "SID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_sid), UINT,
PIDFMT, 0},
@@ -189,13 +189,13 @@ static VAR var[] = {
UINT, UIDFMT, 0},
{"svuid", "SVUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_svuid),
UINT, UIDFMT, 0},
- {"systime", "SYSTIME", NULL, USER|DSIZ, systime, s_systime, 15, 0, CHAR,
+ {"systime", "SYSTIME", NULL, USER, systime, s_systime, 15, 0, CHAR,
NULL, 0},
{"tdaddr", "TDADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_tdaddr), KPTR, "lx", 0},
{"tdev", "TDEV", NULL, 0, tdev, NULL, 5, 0, CHAR, NULL, 0},
{"tdnam", "TDNAM", NULL, LJUST, tdnam, NULL, COMMLEN, 0, CHAR, NULL, 0},
- {"time", "TIME", NULL, USER|DSIZ, cputime, s_cputime, 15, 0, CHAR,
+ {"time", "TIME", NULL, USER, cputime, s_cputime, 15, 0, CHAR,
NULL, 0},
{"tpgid", "TPGID", NULL, 0, kvar, NULL, 4, KOFF(ki_tpgid), UINT,
PIDFMT, 0},
@@ -204,16 +204,16 @@ static VAR var[] = {
{"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0},
{"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0},
{"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0},
- {"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm,
+ {"ucomm", "UCOMM", NULL, LJUST, ucomm, s_comm,
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
UIDFMT, 0},
{"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2,
KOFF(ki_paddr), KPTR, "lx", 0},
- {"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR,
+ {"user", "USER", NULL, LJUST, uname, s_uname, USERLEN, 0, CHAR,
NULL, 0},
- {"usertime", "USERTIME", NULL, USER|DSIZ, usertime, s_usertime, 15, 0,
+ {"usertime", "USERTIME", NULL, USER, usertime, s_usertime, 15, 0,
CHAR, NULL, 0},
{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 0667db9..6bb94bf 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1078,7 +1078,7 @@ scanvars(void)
STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
- if (v->flag & DSIZ) {
+ if (v->sproc != NULL) {
v->dwidth = v->width;
v->width = 0;
}
@@ -1098,9 +1098,9 @@ dynsizevars(KINFO *ki)
STAILQ_FOREACH(vent, &varlist, next_ve) {
v = vent->var;
- if (!(v->flag & DSIZ))
+ if (v->sproc == NULL)
continue;
- i = (v->sproc)( ki);
+ i = (v->sproc)(ki);
if (v->width < i)
v->width = i;
if (v->width > v->dwidth)
diff --git a/bin/ps/ps.h b/bin/ps/ps.h
index ddaebed..b1e9d9b 100644
--- a/bin/ps/ps.h
+++ b/bin/ps/ps.h
@@ -62,12 +62,11 @@ typedef struct var {
#define COMM 0x01 /* needs exec arguments and environment (XXX) */
#define LJUST 0x02 /* left adjust on output (trailing blanks) */
#define USER 0x04 /* needs user structure */
-#define DSIZ 0x08 /* field size is dynamic*/
#define INF127 0x10 /* values >127 displayed as 127 */
u_int flag;
/* output routine */
void (*oproc)(struct kinfo *, struct varent *);
- /* sizing routine*/
+ /* sizing routine */
int (*sproc)(struct kinfo *);
short width; /* printing width */
/*
OpenPOWER on IntegriCloud