Pádraig Brady <[email protected]> writes: > There is negligible perf gain from this one, > but since it's the only fork() left in coreutils > it probably makes sense to use posix_spawn() everywhere.
Yep, the main goal was to get rid of fork(), because Windows does not have it but we can create child processes with posix_spawn there. The tiny performance gain and consistency are nice side effects, though. Not that we can build on Windows currently. You would run into issues because Gnulib doesn't have a fallback for pwd.h and grp.h. Also, 'mkdir -p' still uses fork() and chdir()'s in a child process (see mkancesdirs and savewd in Gnulib). One could probably write that to use openat and mkdirat though, as I asked about in an unrelated topic [1]. > I would consolidate the NEWS to one item along the lines of: > > install, sort, split, and timeout now use posix_spawn() to invoke child > programs > more efficiently and more independently from their own memory usage. Thanks, applied with that change [2]. Collin [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70586#20 [2] https://github.com/coreutils/coreutils/commit/dac96ce3e3a2424919fea6a17978b6e91e575d86
