Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

jail related inconsistencies in FreeBSD tools parameters

3 views
Skip to first unread message

Miroslav Lachman

unread,
Jun 22, 2018, 5:18:05 PM6/22/18
to
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
_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stabl...@freebsd.org"

Chris H

unread,
Jun 22, 2018, 5:50:01 PM6/22/18
to
On Fri, 22 Jun 2018 23:13:17 +0200 "Miroslav Lachman" <000....@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. :-)

--Chris

Miroslav Lachman

unread,
Jun 22, 2018, 6:08:20 PM6/22/18
to
Chris H wrote on 2018/06/22 23:46:
> On Fri, 22 Jun 2018 23:13:17 +0200 "Miroslav Lachman" <000....@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

James Gritton

unread,
Jun 23, 2018, 11:34:32 AM6/23/18
to

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

Eitan Adler

unread,
Jun 23, 2018, 11:49:57 AM6/23/18
to
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

James Gritton

unread,
Jun 23, 2018, 11:54:18 AM6/23/18
to
It already lives there: jail_getid(3)

- Jamie
0 new messages