jail related inconsistencies in FreeBSD tools parameters

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

jail related inconsistencies in FreeBSD tools parameters

Miroslav Lachman
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?

Should I file a PR for it?

Miroslav Lachman

PS: I am on FreeBSD 10.4 so I don't know if something is different in
newer branches
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Chris H-2
On Fri, 22 Jun 2018 23:13:17 +0200 "Miroslav Lachman" <[hidden email]> 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. :-)

--Chris

>
> Should I file a PR for it?
>
> Miroslav Lachman
>
> PS: I am on FreeBSD 10.4 so I don't know if something is different in
> newer branches
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "[hidden email]"


_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Miroslav Lachman
Chris H wrote on 2018/06/22 23:46:

> On Fri, 22 Jun 2018 23:13:17 +0200 "Miroslav Lachman" <[hidden email]>
> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

James Gritton-2
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"
>> <[hidden email]> 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.

- Jamie
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Eitan Adler-4
On 23 June 2018 at 08:30, James Gritton <[hidden email]> 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" <[hidden email]>
>>> 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?



--
Eitan Adler
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

James Gritton-2
On 2018-06-23 09:45, Eitan Adler wrote:

> On 23 June 2018 at 08:30, James Gritton <[hidden email]> 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"
>>>> <[hidden email]>
>>>> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Eitan Adler-4
On 23 June 2018 at 08:50, James Gritton <[hidden email]> wrote:

> On 2018-06-23 09:45, Eitan Adler wrote:
>>
>> On 23 June 2018 at 08:30, James Gritton <[hidden email]> 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"
>>>>> <[hidden email]>
>>>>> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Miroslav Lachman
In reply to this post by James Gritton-2
James Gritton wrote on 2018/06/23 17:30:

> 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"
>>> <[hidden email]> 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.

PR 229266 created

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229266

Kind regards
Miroslav Lachman
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

James Gritton-2
In reply to this post by Eitan Adler-4
On 2018-06-23 12:58, Eitan Adler wrote:

> On 23 June 2018 at 08:50, James Gritton <[hidden email]> wrote:
>> On 2018-06-23 09:45, Eitan Adler wrote:
>>>
>>> On 23 June 2018 at 08:30, James Gritton <[hidden email]> 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"
>>>>>> <[hidden email]>
>>>>>> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: jail related inconsistencies in FreeBSD tools parameters

Miroslav Lachman
James Gritton wrote on 2018/06/26 20:42:
> On 2018-06-23 12:58, Eitan Adler wrote:

[...]

>> 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).

Thank you very much. I really appreciate your neverending work on jails!
I hope it will be committed soon.

Kind regards
Miroslav Lachman
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"