From 0b1c752b5c40a85d5c749cd30ee6811997a8f71e Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Fri, 17 Jun 2022 06:55:44 -0400 Subject: [PATCH] zos: implement uv_available_parallelism() (#3650) Implement uv_available_parallelism() for z/OS by reporting the number of online cpu using __get_num_online_cpus() from ZOSLIB. --- src/unix/core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/unix/core.c b/src/unix/core.c index fd4f34809..54c769f37 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -81,7 +81,8 @@ extern char** environ; #endif #if defined(__MVS__) -#include +# include +# include "zos-sys-info.h" #endif #if defined(__linux__) @@ -1647,7 +1648,13 @@ unsigned int uv_available_parallelism(void) { return (unsigned) rc; #elif defined(__MVS__) - return 1; /* TODO(bnoordhuis) Read from CSD_NUMBER_ONLINE_CPUS? */ + int rc; + + rc = __get_num_online_cpus(); + if (rc < 1) + rc = 1; + + return (unsigned) rc; #else /* __linux__ */ long rc;