From owner-freebsd-jail@freebsd.org Sat Jun 23 18:59:31 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 972B9100278B for ; Sat, 23 Jun 2018 18:59:31 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yb0-x229.google.com (mail-yb0-x229.google.com [IPv6:2607:f8b0:4002:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 248598E426 for ; Sat, 23 Jun 2018 18:59:31 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yb0-x229.google.com with SMTP id y187-v6so2771827yby.8 for ; Sat, 23 Jun 2018 11:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=k5idQu0415WccGq4dB8hDuls2JTA5mvjxum5FqR0xPU=; b=ApphqxmRgNutt527SGDb1YMXNmtRathFbtnodTejUCzBIJ+jxonAJB+6iP1TopXZy8 p/K/UPHnIzLbiaUZ9IVOaqvHocw0FNkAKm0ox/+CoAoLQ3DzD2ZNBkyYhMEwqTWRG6zQ yJySyCM2VVnZbx0bxsar9lPTFfiXIdWpAEyIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=k5idQu0415WccGq4dB8hDuls2JTA5mvjxum5FqR0xPU=; b=JZq525GBRm3KlFOVR99+BFUQy+Eqz/71pxjHoYdimuM0J0mYXVmwQfzjX7xvCDqOSo PZO6d689dQoTCq3O0fPjJO6nph+A0ElEXrS6jSFEQJybUuxj46qhdmC5GAGsFj8s0wvl Nar1OGqKqTVIqCIspTdiyOxt4egelGZKUpQQrfEsoqx1/Rws5dQyFf3FW3S6JeqG8HrM S3euw+UXGWhZFE4Yi2nK5aYalmX7AdVhn2Uxb77ffZkxYH+Vs8YlrmS4I2kf3koSVBHI eM2n9Z0CDx5TZY3KxFQX3wqe21CPQswDXXyEQEXfH1CmSdRFKk63cSCWwq3ww4XydpWE GkiQ== X-Gm-Message-State: APt69E3zoPT3x6uM5xIdNNCDzVcqW8of3l8UfMPV2ah84/9X48KuxwPh BiBBU8hLqPwTR56D5nGZ8RPF42D4OB+RT7F5zsToCw== X-Google-Smtp-Source: ADUXVKLndiphHnmhCUH3iCsmdGqeCqPgLxaeZcQTzVxKpiKFOnNNChBwRpz9oe+XMx5ECIMDHKk+Yq9Vo5T7xi11HBc= X-Received: by 2002:a25:734f:: with SMTP id o76-v6mr3198890ybc.69.1529780370323; Sat, 23 Jun 2018 11:59:30 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ef50:0:0:0:0:0 with HTTP; Sat, 23 Jun 2018 11:58:59 -0700 (PDT) In-Reply-To: <51718e96f63175e997cb8268381d1070@freebsd.org> References: <6dd9952452c73826a2f9c01612586bea@udns.ultimatedns.net> <18000a3b93085c91aeffbca937862786@freebsd.org> <51718e96f63175e997cb8268381d1070@freebsd.org> From: Eitan Adler Date: Sat, 23 Jun 2018 11:58:59 -0700 Message-ID: Subject: Re: jail related inconsistencies in FreeBSD tools parameters To: James Gritton Cc: bsd-lists@bsdforge.com, freebsd-jail@freebsd.org, freebsd-stable Stable Content-Type: text/plain; charset="UTF-8" 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: Sat, 23 Jun 2018 18:59:31 -0000 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. -- Eitan Adler