aboutsummaryrefslogtreecommitdiff
path: root/bin/ps
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /bin/ps
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
downloadsrc-23090366f729c56cab62de74c7a51792357e98a9.tar.gz
src-23090366f729c56cab62de74c7a51792357e98a9.zip
Notes
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/keyword.c2
-rw-r--r--bin/ps/print.c10
-rw-r--r--bin/ps/ps.16
-rw-r--r--bin/ps/ps.c4
4 files changed, 15 insertions, 7 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 6c380e8b8f15..5861129c82a8 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -79,6 +79,7 @@ static VAR var[] = {
{"cow", "COW", NULL, 0, kvar, KOFF(ki_cow), UINT, "u", 0},
{"cpu", "CPU", NULL, 0, kvar, KOFF(ki_estcpu), UINT, "d", 0},
{"cputime", "", "time", 0, NULL, 0, CHAR, NULL, 0},
+ {"dsiz", "DSIZ", NULL, 0, kvar, KOFF(ki_dsize), PGTOK, "ld", 0},
{"egid", "", "gid", 0, NULL, 0, CHAR, NULL, 0},
{"egroup", "", "group", 0, NULL, 0, CHAR, NULL, 0},
{"emul", "EMUL", NULL, LJUST, emulname, 0, CHAR, NULL, 0},
@@ -141,6 +142,7 @@ static VAR var[] = {
UINT, "x", 0},
{"sigmask", "BLOCKED", NULL, 0, kvar, KOFF(ki_sigmask), UINT, "x", 0},
{"sl", "SL", NULL, INF127, kvar, KOFF(ki_slptime), UINT, "d", 0},
+ {"ssiz", "SSIZ", NULL, 0, kvar, KOFF(ki_ssize), PGTOK, "ld", 0},
{"start", "STARTED", NULL, LJUST|USER, started, 0, CHAR, NULL, 0},
{"stat", "", "state", 0, NULL, 0, CHAR, NULL, 0},
{"state", "STAT", NULL, LJUST, state, 0, CHAR, NULL, 0},
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 5c9398d63514..f36411e786a9 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -387,12 +387,13 @@ started(KINFO *k, VARENT *ve __unused)
size_t buflen = 100;
char *buf;
+ if (!k->ki_valid)
+ return (NULL);
+
buf = malloc(buflen);
if (buf == NULL)
errx(1, "malloc failed");
- if (!k->ki_valid)
- return (NULL);
if (use_ampm < 0)
use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
then = k->ki_p->ki_start.tv_sec;
@@ -415,12 +416,13 @@ lstarted(KINFO *k, VARENT *ve __unused)
char *buf;
size_t buflen = 100;
+ if (!k->ki_valid)
+ return (NULL);
+
buf = malloc(buflen);
if (buf == NULL)
errx(1, "malloc failed");
- if (!k->ki_valid)
- return (NULL);
then = k->ki_p->ki_start.tv_sec;
(void)strftime(buf, buflen, "%c", localtime(&then));
return (buf);
diff --git a/bin/ps/ps.1 b/bin/ps/ps.1
index d1627f640cd4..21e8eaf37cb6 100644
--- a/bin/ps/ps.1
+++ b/bin/ps/ps.1
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd May 20, 2012
+.Dd September 18, 2012
.Dt PS 1
.Os
.Sh NAME
@@ -500,6 +500,8 @@ command and arguments
number of copy-on-write faults
.It Cm cpu
short-term CPU usage factor (for scheduling)
+.It Cm dsiz
+data size (in Kbytes)
.It Cm emul
system-call emulation environment
.It Cm etime
@@ -610,6 +612,8 @@ blocked signals (alias
.Cm blocked )
.It Cm sl
sleep time (in seconds; 127 = infinity)
+.It Cm ssiz
+stack size (in Kbytes)
.It Cm start
time started
.It Cm state
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index f507b6a028f3..ebabc1952fab 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -889,8 +889,8 @@ add_list(struct listinfo *inf, const char *argp)
int toolong;
char elemcopy[PATH_MAX];
- if (*argp == 0)
- inf->addelem(inf, elemcopy);
+ if (*argp == '\0')
+ inf->addelem(inf, argp);
while (*argp != '\0') {
while (*argp != '\0' && strchr(W_SEP, *argp) != NULL)
argp++;