From owner-freebsd-stable@freebsd.org Sat Jun 23 15:50:10 2018 Return-Path: Delivered-To: freebsd-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 3B0C11025B5C; Sat, 23 Jun 2018 15:50:10 +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 C480188405; Sat, 23 Jun 2018 15:50:09 +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 w5NFo0Rw096329; Sat, 23 Jun 2018 09:50:00 -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: Sat, 23 Jun 2018 09:50:00 -0600 From: James Gritton To: bsd-lists@bsdforge.com, freebsd-jail@freebsd.org, freebsd-stable Stable Cc: Eitan Adler Subject: Re: jail related inconsistencies in FreeBSD tools parameters In-Reply-To: References: <6dd9952452c73826a2f9c01612586bea@udns.ultimatedns.net> <18000a3b93085c91aeffbca937862786@freebsd.org> Message-ID: <51718e96f63175e997cb8268381d1070@freebsd.org> X-Sender: jamie@freebsd.org User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2018 15:50:10 -0000 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) - Jamie