svn commit: r331471 - in stable: 10/bin/ps 11/bin/ps
John Baldwin
jhb at FreeBSD.org
Sat Mar 24 00:26:43 UTC 2018
Author: jhb
Date: Sat Mar 24 00:26:42 2018
New Revision: 331471
URL: https://svnweb.freebsd.org/changeset/base/331471
Log:
MFC 330872:
Add a "jail" keyword to list the name of a jail rather than its ID.
Modified:
stable/10/bin/ps/extern.h
stable/10/bin/ps/keyword.c
stable/10/bin/ps/print.c
stable/10/bin/ps/ps.1
Directory Properties:
stable/10/ (props changed)
Changes in other areas also in this revision:
Modified:
stable/11/bin/ps/extern.h
stable/11/bin/ps/keyword.c
stable/11/bin/ps/print.c
stable/11/bin/ps/ps.1
Directory Properties:
stable/11/ (props changed)
Modified: stable/10/bin/ps/extern.h
==============================================================================
--- stable/10/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470)
+++ stable/10/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471)
@@ -53,6 +53,7 @@ char *emulname(KINFO *, VARENT *);
VARENT *find_varentry(VAR *);
const char *fmt_argv(char **, char *, char *, size_t);
double getpcpu(const KINFO *);
+char *jailname(KINFO *, VARENT *);
char *kvar(KINFO *, VARENT *);
char *label(KINFO *, VARENT *);
char *loginclass(KINFO *, VARENT *);
Modified: stable/10/bin/ps/keyword.c
==============================================================================
--- stable/10/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470)
+++ stable/10/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471)
@@ -96,6 +96,7 @@ static VAR var[] = {
{"ignored", "", "sigignore", 0, NULL, 0, CHAR, NULL, 0},
{"inblk", "INBLK", NULL, USER, rvar, ROFF(ru_inblock), LONG, "ld", 0},
{"inblock", "", "inblk", 0, NULL, 0, CHAR, NULL, 0},
+ {"jail", "JAIL", NULL, LJUST, jailname, 0, CHAR, NULL, 0},
{"jid", "JID", NULL, 0, kvar, KOFF(ki_jid), INT, "d", 0},
{"jobc", "JOBC", NULL, 0, kvar, KOFF(ki_jobc), SHORT, "d", 0},
{"ktrace", "KTRACE", NULL, 0, kvar, KOFF(ki_traceflag), INT, "x", 0},
Modified: stable/10/bin/ps/print.c
==============================================================================
--- stable/10/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470)
+++ stable/10/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <grp.h>
+#include <jail.h>
#include <langinfo.h>
#include <locale.h>
#include <math.h>
@@ -839,4 +840,17 @@ loginclass(KINFO *k, VARENT *ve __unused)
return (strdup("-"));
}
return (strdup(k->ki_p->ki_loginclass));
+}
+
+char *
+jailname(KINFO *k, VARENT *ve __unused)
+{
+ char *name;
+
+ if (k->ki_p->ki_jid == 0)
+ return (strdup("-"));
+ name = jail_getname(k->ki_p->ki_jid);
+ if (name == NULL)
+ return (strdup("-"));
+ return (name);
}
Modified: stable/10/bin/ps/ps.1
==============================================================================
--- stable/10/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470)
+++ stable/10/bin/ps/ps.1 Sat Mar 24 00:26:42 2018 (r331471)
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd August 12, 2016
+.Dd March 13, 2018
.Dt PS 1
.Os
.Sh NAME
@@ -554,6 +554,8 @@ group name (from egid) (alias
.It Cm inblk
total blocks read (alias
.Cm inblock )
+.It Cm jail
+jail name
.It Cm jid
jail ID
.It Cm jobc
More information about the svn-src-stable-10
mailing list