diff options
author | John Baldwin <jhb@FreeBSD.org> | 2018-03-13 18:30:26 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2018-03-13 18:30:26 +0000 |
commit | 2f5a9b7661f483580f6e801ba050dc15f27e2721 (patch) | |
tree | af7f5d4f8377fb417bce3d1a94ec0c1307fddd4a /bin/ps/print.c | |
parent | 741e1c9196f47d45630955481a93aa54673cb820 (diff) | |
download | src-2f5a9b7661f483580f6e801ba050dc15f27e2721.tar.gz src-2f5a9b7661f483580f6e801ba050dc15f27e2721.zip |
Add a "jail" keyword to list the name of a jail rather than its ID.
Inspired by: mwlucas
Reviewed by: jamie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14683
Notes
Notes:
svn path=/head/; revision=330872
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r-- | bin/ps/print.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 437c1cbfc83a..c2853071b451 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <grp.h> +#include <jail.h> #include <langinfo.h> #include <locale.h> #include <math.h> @@ -840,3 +841,16 @@ loginclass(KINFO *k, VARENT *ve __unused) } 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); +} |