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.
This commit is contained in:
Wayne Zhang 2022-06-17 06:55:44 -04:00 committed by GitHub
parent 8bcd689c04
commit 0b1c752b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,8 @@ extern char** environ;
#endif
#if defined(__MVS__)
#include <sys/ioctl.h>
# include <sys/ioctl.h>
# 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;