From owner-svn-src-stable@freebsd.org Sat Mar 24 00:26:43 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCB3DF5A7BD; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ACED6D7B8; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65B64272E3; Sat, 24 Mar 2018 00:26:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2O0QhoZ044080; Sat, 24 Mar 2018 00:26:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2O0Qgm3044076; Sat, 24 Mar 2018 00:26:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201803240026.w2O0Qgm3044076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 24 Mar 2018 00:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331471 - in stable: 10/bin/ps 11/bin/ps X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/bin/ps 11/bin/ps X-SVN-Commit-Revision: 331471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Mar 2018 00:26:44 -0000 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/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) Changes in other areas also in this revision: 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) Modified: stable/11/bin/ps/extern.h ============================================================================== --- stable/11/bin/ps/extern.h Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/extern.h Sat Mar 24 00:26:42 2018 (r331471) @@ -55,6 +55,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/11/bin/ps/keyword.c ============================================================================== --- stable/11/bin/ps/keyword.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/keyword.c Sat Mar 24 00:26:42 2018 (r331471) @@ -108,6 +108,7 @@ static VAR var[] = { {"inblk", "INBLK", NULL, "read-blocks", USER, rvar, ROFF(ru_inblock), LONG, "ld", 0}, {"inblock", "", "inblk", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"jail", "JAIL", NULL, "jail-name", LJUST, jailname, 0, CHAR, NULL, 0}, {"jid", "JID", NULL, "jail-id", 0, kvar, KOFF(ki_jid), INT, "d", 0}, {"jobc", "JOBC", NULL, "job-control-count", 0, kvar, KOFF(ki_jobc), SHORT, "d", 0}, Modified: stable/11/bin/ps/print.c ============================================================================== --- stable/11/bin/ps/print.c Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/bin/ps/print.c Sat Mar 24 00:26:42 2018 (r331471) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -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/11/bin/ps/ps.1 ============================================================================== --- stable/11/bin/ps/ps.1 Fri Mar 23 23:46:59 2018 (r331470) +++ stable/11/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 January 23, 2018 +.Dd March 13, 2018 .Dt PS 1 .Os .Sh NAME @@ -566,6 +566,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