Date: Tue, 12 Apr 2011 20:10:15 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r220574 - head/bin/ps Message-ID: <201104122010.p3CKAFfv034376@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue Apr 12 20:10:15 2011 New Revision: 220574 URL: http://svn.freebsd.org/changeset/base/220574 Log: Get rid of DSIZ; instead just call the sizing function if provided. Modified: head/bin/ps/keyword.c head/bin/ps/ps.c head/bin/ps/ps.h Modified: head/bin/ps/keyword.c ============================================================================== --- head/bin/ps/keyword.c Tue Apr 12 19:13:10 2011 (r220573) +++ head/bin/ps/keyword.c Tue Apr 12 20:10:15 2011 (r220574) @@ -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}, Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Tue Apr 12 19:13:10 2011 (r220573) +++ head/bin/ps/ps.c Tue Apr 12 20:10:15 2011 (r220574) @@ -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) Modified: head/bin/ps/ps.h ============================================================================== --- head/bin/ps/ps.h Tue Apr 12 19:13:10 2011 (r220573) +++ head/bin/ps/ps.h Tue Apr 12 20:10:15 2011 (r220574) @@ -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 */ /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104122010.p3CKAFfv034376>