Created attachment 156407 [details] xargs: implement -P0 This simple patch implements GNU-like xargs -P0 to run "as many processes as possible". This option is convenient and allows many of my scripts to port. There are a couple of differences from GNU behavior to make this consistent with other options in our xargs: -P takes negative numbers, which mean the same as -P0, and the maximum number of procs is equal to maxargs rather than some *_MAX macro. This is probably what the user wants, performs a lot better, and doesn't hurt intended -P0 portability. Tested with: kyua test -k /usr/tests/Kyuafile usr.bin/xargs (passed)
If accepted, please MFC this option to 10-STABLE. It would be awesome to see this in 10.2-RELEASE.
I'm not sure what kind of workflow is easier, so there is also a pull request #31 on github with this patch.
A commit references this bug: Author: allanjude Date: Tue Aug 4 14:27:26 UTC 2015 New revision: 286289 URL: https://svnweb.freebsd.org/changeset/base/286289 Log: xargs now takes -P0, creating as many concurrent processes as possible PR: 199976 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> Reviewed by: mjg, bjk Approved by: bapt (mentor) MFC after: 1 month Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D2616 Changes: head/usr.bin/xargs/xargs.1 head/usr.bin/xargs/xargs.c
Sorry this missed 10.2-RELEASE, but it will be merged to 10-STABLE after the MFC period.
This can probably be closed. The issue has been resolved in head/.
This change was committed (and fixed).
A commit references this bug: Author: allanjude Date: Tue Jan 12 05:51:13 UTC 2016 New revision: 293726 URL: https://svnweb.freebsd.org/changeset/base/293726 Log: MFC: r285552 Use strtonum(3) instead of atoi(3) MFC: r286289 Introduce -P0, creating as many concurrent processes as possible Relnotes: yes MFC: r286461 Fix regression in xargs -Px, add more regression tests MFC: r287004 MFC: r287005 Fix the racy xargs -P0 -n2 test added in r286289 PR: 199976 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> Changes: _U stable/10/ stable/10/usr.bin/xargs/tests/Makefile stable/10/usr.bin/xargs/tests/regress.0P1.out stable/10/usr.bin/xargs/tests/regress.P1.out stable/10/usr.bin/xargs/tests/regress.n2P0.out stable/10/usr.bin/xargs/tests/regress.sh stable/10/usr.bin/xargs/xargs.1 stable/10/usr.bin/xargs/xargs.c