summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkstailey <kstailey@openbsd.org>1997-08-22 20:08:13 +0000
committerkstailey <kstailey@openbsd.org>1997-08-22 20:08:13 +0000
commit50b7cf99831170407419fae0e8b9ce5342fb6a0c (patch)
treee63690a0f42b59e95cb8d9bdd1d8831547aa623f
parentfetch bios geometry for the boot hd (diff)
downloadwireguard-openbsd-50b7cf99831170407419fae0e8b9ce5342fb6a0c.tar.xz
wireguard-openbsd-50b7cf99831170407419fae0e8b9ce5342fb6a0c.zip
XPG4 compatibility for format options:
two new options: group and rgroup. three new aliases: etime for start, comm for ucomm, and args for command.
-rw-r--r--bin/ps/extern.h4
-rw-r--r--bin/ps/keyword.c9
-rw-r--r--bin/ps/print.c28
3 files changed, 36 insertions, 5 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index f519ac8873c..66785bf753b 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.3 1997/08/04 05:37:03 deraadt Exp $ */
+/* $OpenBSD: extern.h,v 1.4 1997/08/22 20:08:13 kstailey Exp $ */
/* $NetBSD: extern.h,v 1.10 1995/05/21 13:38:27 mycroft Exp $ */
/*-
@@ -56,6 +56,7 @@ void fmt_puts __P((char *, int *));
void fmt_putc __P((int, int *));
double getpcpu __P((KINFO *));
double getpmem __P((KINFO *));
+void gname __P((KINFO *, VARENT *));
void logname __P((KINFO *, VARENT *));
void longtname __P((KINFO *, VARENT *));
void lstarted __P((KINFO *, VARENT *));
@@ -69,6 +70,7 @@ void pmem __P((KINFO *, VARENT *));
void pri __P((KINFO *, VARENT *));
void printheader __P((void));
void pvar __P((KINFO *, VARENT *));
+void rgname __P((KINFO *, VARENT *));
void rssize __P((KINFO *, VARENT *));
void runame __P((KINFO *, VARENT *));
void rvar __P((KINFO *, VARENT *));
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 8178408d4f3..b6445cfe031 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyword.c,v 1.9 1997/08/08 19:30:09 millert Exp $ */
+/* $OpenBSD: keyword.c,v 1.10 1997/08/22 20:08:14 kstailey Exp $ */
/* $NetBSD: keyword.c,v 1.12.6.1 1996/05/30 21:25:13 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: keyword.c,v 1.9 1997/08/08 19:30:09 millert Exp $";
+static char rcsid[] = "$OpenBSD: keyword.c,v 1.10 1997/08/22 20:08:14 kstailey Exp $";
#endif
#endif /* not lint */
@@ -95,14 +95,18 @@ VAR var[] = {
{"%mem", "%MEM", NULL, 0, pmem, 4},
{"acflag", "ACFLG", NULL, 0, pvar, 3, 0, POFF(p_acflag), USHORT, "x"},
{"acflg", "", "acflag"},
+ {"args", "", "command"},
{"blocked", "", "sigmask"},
{"caught", "", "sigcatch"},
+ {"comm", "", "ucomm"},
{"command", "COMMAND", NULL, COMM|LJUST|USER, command, 16},
{"cpu", "CPU", NULL, 0, pvar, 3, 0, POFF(p_estcpu), UINT, "d"},
{"cputime", "", "time"},
+ {"etime", "", "start"},
{"f", "F", NULL, 0, pvar, 7, 0, POFF(p_flag), INT, "x"},
{"flags", "", "f"},
GID("gid", "GID", evar, EOFF(e_ucred.cr_gid)),
+ {"group", "GROUP", NULL, 0, gname, USERLEN},
{"holdcnt", "HOLDCNT", NULL, 0, pvar, 8, 0, POFF(p_holdcnt), INT, "d"},
{"ignored", "", "sigignore"},
{"inblk", "INBLK", NULL, USER, rvar, 4, 0, ROFF(ru_inblock), LONG, "d"},
@@ -145,6 +149,7 @@ VAR var[] = {
{"re", "RE", NULL, INF127, pvar, 3, 0, POFF(p_swtime), UINT, "d"},
GID("rgid", "RGID", evar, EOFF(e_pcred.p_rgid)),
/* XXX */
+ {"rgroup", "RGROUP", NULL, LJUST, rgname, USERLEN},
{"rlink", "RLINK", NULL, 0, pvar, 8, 0, POFF(p_back), KPTR, "x"},
{"rss", "RSS", NULL, 0, p_rssize, 4},
{"rssize", "", "rsz"},
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 364f9eea443..1ab2f1669bf 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.6 1997/08/04 05:37:04 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.7 1997/08/22 20:08:14 kstailey Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.6 1997/08/04 05:37:04 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.7 1997/08/22 20:08:14 kstailey Exp $";
#endif
#endif /* not lint */
@@ -277,6 +277,30 @@ runame(k, ve)
}
void
+gname(k, ve)
+ KINFO *k;
+ VARENT *ve;
+{
+ VAR *v;
+
+ v = ve->var;
+ (void)printf("%-*s",
+ (int)v->width, group_from_gid(KI_EPROC(k)->e_ucred.cr_gid, 0));
+}
+
+void
+rgname(k, ve)
+ KINFO *k;
+ VARENT *ve;
+{
+ VAR *v;
+
+ v = ve->var;
+ (void)printf("%-*s",
+ (int)v->width, group_from_gid(KI_EPROC(k)->e_pcred.p_rgid, 0));
+}
+
+void
tdev(k, ve)
KINFO *k;
VARENT *ve;