libuv: Restore support for setting child process affinity

libuv now prefers `posix_spawn` to launch processes on unix.
It does not offer a way to set the child process affinity on
startup, so fall back to `fork` and `exec` if we need affinity.

This restores commit 24de561a1a (libuv: unix,win: add uv_spawn option
to set child CPU affinity mask, 2017-09-06, v3.12.0-rc1~412^2~2).
This commit is contained in:
Brad King committed 2026-10-08 09:01:28 -04:00
1 parent d9f518e897
commit b85b6ded3b
1 file changed
+10
+10
View File
@@ -903,6 +903,16 @@ static int uv__spawn_and_init_child_posix_spawn(
if (!posix_spawn_works)
return UV_ENOSYS;
#ifndef CMAKE_BOOTSTRAP
#if defined(__linux__) || defined(__FreeBSD__)
if (options->cpumask != NULL) {
/* posix_spawn does not offer a way to set the child process
affinity, so fall back to the fork/exec code path. */
return UV_ENOSYS;
}
#endif
#endif
err = uv__spawn_set_posix_spawn_attrs(&attrs, options);
if (err != 0)
goto error;