From owner-freebsd-jail@freebsd.org Tue Jun 26 14:54:57 2018 Return-Path: Delivered-To: freebsd-jail@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 3D26C102A10D for ; Tue, 26 Jun 2018 14:54:56 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: from m97106.mail.qiye.163.com (m97106.mail.qiye.163.com [220.181.97.106]) by mx1.freebsd.org (Postfix) with ESMTP id 9BFCF7400B for ; Tue, 26 Jun 2018 14:54:52 +0000 (UTC) (envelope-from kelly@rsw-power.com) Received: from localhost (unknown [127.0.0.1]) by wmsvr3 (Coremail) with SMTP id TSWEB_000000070000730B5B325075; Tue, 26 Jun 2018 22:40:53 +0800 (CST) Received: from kelly$rsw-power.com ( [119.123.74.132] ) by ajax-webmail-wmsvr12 (Coremail) ; Mon, 25 Jun 2018 17:09:05 +0800 (CST) X-Originating-IP: [119.123.74.132] Date: Tue, 26 Jun 2018 22:40:00 +0800 (CST) From: kelly To: freebsd-jail@freebsd.org Subject: Re: Handheld Inkjet Printer Manufacturer X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150911(74783.7961) Copyright (c) 2002-2018 www.mailtech.cn 163-hosting MIME-Version: 1.0 Message-ID: <123b8573.12e8c.16436342a0b.Coremail.kelly@rsw-power.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: auCowADX5JZ9UDJbMYUgAA--.3W X-CM-SenderInfo: xnhoz546uv4gpsrzv2oofrz/1tbifR1wElrpMw+8fAABsM X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Arch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GltZSwgY291bnRlciwgc3ltYm9scywgbG9nbywgbWFya3MsIHNtYWxsIHBpY3R1 cmVzIGV0Yy4KLVdlIGhhdmUgbGFyZ2UgZGF0YSBzdG9yZSB1cCB0byAyMDAgbWVzc2FnZXMuCi1X ZSBoYXZlIGRpZmZlcmVudCBjb2xvcnMgaW5rOiBibGFjaywgcmVkLCBidWxlLHllbGxvdywgd2hp dGUgYW5kIGludmlzaWJsZSBVViBsaWdodCBpbmsuCiAgICAKQW55IGludGVyZXN0cyBwbGVhc2Ug Y29udGFjdCB1cyBmb3IgbW9yZSBpbmZvcm1hdGlvbi5XZSBjYW4gc2hvdyB5b3Ugb3VyIGJyb2No dXJlIGFuZCB2aWRlby4gU2FtcGxlIGFyZSBhdmFpbGFibGUsIHRvbyEKICAgICAgICAgICAgICAg ICAKVGhhbmtzIGFuZCBSZWdhcmRzLAotLQoKS2VsbHkgQ2hlbgpTYWxlcyBSZXByZXNlbnRhdGl2 ZQpTaGVuemhlbiBTd2Fyb25pa2kgVGVjaG5vbG9neSBDby4sIEx0ZC4gICAgICAgICAKTW9iaWxl ICYgV2hhdHNhcHA6ODYtMTMyNjY2ODU2NjkKU2t5cGU6IGtlbGx5XzMxNjcKV2ViOnd3dy5iZXNo ZW5ncHJpbnRlcnMuY29t From owner-freebsd-jail@freebsd.org Tue Jun 26 18:43:08 2018 Return-Path: Delivered-To: freebsd-jail@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 6623A1010F1C; Tue, 26 Jun 2018 18:43:08 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org (gritton.org [199.192.165.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gritton.org", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 05BBA7DD09; Tue, 26 Jun 2018 18:43:07 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org ([127.0.0.131]) by gritton.org (8.15.2/8.15.2) with ESMTP id w5QIgqIK007004; Tue, 26 Jun 2018 12:42:52 -0600 (MDT) (envelope-from jamie@freebsd.org) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 26 Jun 2018 12:42:52 -0600 From: James Gritton To: Eitan Adler Cc: bsd-lists@bsdforge.com, freebsd-jail@freebsd.org, freebsd-stable Stable Subject: Re: jail related inconsistencies in FreeBSD tools parameters In-Reply-To: References: <6dd9952452c73826a2f9c01612586bea@udns.ultimatedns.net> <18000a3b93085c91aeffbca937862786@freebsd.org> <51718e96f63175e997cb8268381d1070@freebsd.org> Message-ID: <8b11953ce292aff0bc60298e2e7613d6@freebsd.org> X-Sender: jamie@freebsd.org User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2018 18:43:08 -0000 On 2018-06-23 12:58, Eitan Adler wrote: > On 23 June 2018 at 08:50, James Gritton wrote: >> On 2018-06-23 09:45, Eitan Adler wrote: >>> >>> On 23 June 2018 at 08:30, James Gritton wrote: >>>> >>>> On 2018-06-22 16:03, Miroslav Lachman wrote: >>>>> >>>>> >>>>> Chris H wrote on 2018/06/22 23:46: >>>>>> >>>>>> >>>>>> On Fri, 22 Jun 2018 23:13:17 +0200 "Miroslav Lachman" >>>>>> <000.fbsd@quip.cz> >>>>>> said >>>>>> >>>>>>> I don't know if it is better to discuss it in jail@ or stable@ >>>>>>> list so >>>>>>> a >>>>>>> do cross-post. >>>>>>> >>>>>>> FreeBSD has many jail aware utilities but they are inconsistent >>>>>>> in >>>>>>> taking JID as parameter. >>>>>>> >>>>>>> For example "sockstat" takes -j JID "Show only sockets belonging >>>>>>> to >>>>>>> the >>>>>>> specified jail ID" and it means numeric ID only. >>>>>>> On the other hand "ps" takes -J JID "This may be either the jid >>>>>>> or >>>>>>> name >>>>>>> of the jail. Use -J 0 to display only host processes." >>>>>>> The same apply for "top", it understands jid as a number or name >>>>>>> of >>>>>>> the >>>>>>> jail too. >>>>>>> Then again "cpuset" takes only numerical ID of the jail... >>>>>>> >>>>>>> Shouldn't it be consistent across all FreeBSD base utilities so >>>>>>> all of >>>>>>> them can use numerical ID and name? >>>>>> >>>>>> >>>>>> Good idea! Are you offering to create a patch? ;-) >>>>>> It'd be my guess that given they weren't all created at the same >>>>>> time, >>>>>> nor >>>>>> the same individual; that (quite probably?) the "jail" additions >>>>>> were >>>>>> also >>>>>> added at different times, and by different people. So I'd imagine >>>>>> that >>>>>> unless someone with a commit bit decides one day they'd like to >>>>>> take >>>>>> that >>>>>> on. Someone(tm) maybe you? will need to propose a patch. :-) >>>>> >>>>> >>>>> >>>>> If I can understand C sources I will create the patch by myself >>>>> instead of just posting here. Unfortunately I am able to code in >>>>> sh, >>>>> php and a bit of javascript and perl but no C. :) >>>>> >>>>> Miroslav Lachman >>>> >>>> >>>> >>>> Sure, a PR would be handy for this - it's a pretty simple thing to >>>> add, >>>> and >>>> consistency would indeed be a good move. >>> >>> >>> Agreed. I'll review and commit such patches. I'd like to see a single >>> function for taking a "id or name". Ideally it would live in a >>> library, perhaps libjail? >> >> >> It already lives there: jail_getid(3) > > I was thinking of a more generic one that does id or name. Now that I > think about it a bit more, C makes this kind of thing impossible to do > usefully. > > That said, I'll still review and commit any patches to existing tools > to make them behave consistently. Yes, jail_getid(3) works with either a numeric ID or a name. I've added a patch to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229266 for the four programs I've found that need help. I've tested the easy ones (cpuset and sockstat). - Jamie