Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2023 08:08:48 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        dev-commits-src-main@freebsd.org
Subject:   Re: git: d9d5f2c042a5 - main - cpuset: add --count [changed/broken command line parsing]
Message-ID:  <CAGudoHETv8i9pWS=x0sx%2B5TGLnWwA%2BsjmpD%2BOC5OZ9J9rThtVw@mail.gmail.com>
In-Reply-To: <D2D940CD-B1A0-41B7-8C02-63CA63940525@yahoo.com>
References:  <D2D940CD-B1A0-41B7-8C02-63CA63940525.ref@yahoo.com> <D2D940CD-B1A0-41B7-8C02-63CA63940525@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2/15/23, Mark Millard <marklmi@yahoo.com> wrote:
> Mateusz Guzik <mjg_at_FreeBSD.org> wrote on
> Date: Sat, 04 Feb 2023 17:51:27 UTC :
>
>> The branch main has been updated by mjg:
>>
>> URL:
>> https://cgit.FreeBSD.org/src/commit/?id=d9d5f2c042a51a9f0dd69eb1fc349efd81ffa483
>>
>> commit d9d5f2c042a51a9f0dd69eb1fc349efd81ffa483
>> Author: Mateusz Guzik <mjg@FreeBSD.org>
>> AuthorDate: 2023-02-04 17:47:41 +0000
>> Commit: Mateusz Guzik <mjg@FreeBSD.org>
>> CommitDate: 2023-02-04 17:50:41 +0000
>>
>> cpuset: add --count
>>
>> Can be used to count the number of hardware threads in the cpu set.
>>
>> For example:
>> $ cpuset -g -p $$
>> pid 2440 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
>> 35, 36, 37, 38, 39
>> pid 2440 domain policy: first-touch mask: 0, 1
>> $ cpuset -g --count -p $$
>> 40
>>
>> The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus which
>> can be found in the tree, which are not adequate given existence of
>> cpusets.
>>
>> Right now only -g -p combination is supported to reduce complexity.
>> As anything else errors out, this can be expanded later as needed.
>>
>> Differential Revision: https://reviews.freebsd.org/D36351
>
> This broke long standing commands sequences in some makefiles
> that I use to build and run some benchmarks, the commands
> at issue involve use of cpuset.
>
> However I can show the oddity in a much simpler context:
>
> # cpuset echo "text"
> text
>
> # cpuset echo "-text"
> usage: cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] cmd ...
>        cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] -p pid
>        cpuset [-c] [-l cpu-list] [-n policy:domain-list] -C -p pid
>        cpuset [-c] [-l cpu-list] [-n policy:domain-list]
>               [-j jailid | -p pid | -t tid | -s setid | -x irq]
>        cpuset -g [-cir]
>               [-d domain | -j jailid | -p pid | -t tid | -s setid | -x irq]
>        cpuset -g --count -p pid
>
>
> By contrast, in my stable/13 context, so, showing the old behavior:
>
> # cpuset echo "-text"
> -text
>

the idiomatic way to pass progs to spawn is to denote the end of any
opts with --

so in particular you would:
cpuset -- echo -text

the fact that previous version worked without it is kind of a bug

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHETv8i9pWS=x0sx%2B5TGLnWwA%2BsjmpD%2BOC5OZ9J9rThtVw>