Hi Yaakov,
May I update the version of util-linux available on Cygwin? Your cygport file for the current 2.33.1 seems to work fine for the latest 2.35.1.

I would add a patch file 2.33.1-cygwin-cpuset.patch (see attached) and update the cygport file to reference this additional patch and remove the "--disable-schedutils" from CYGCONF_ARGS. With these changes a working
'taskset.exe' will be an additional build output.

I would package the latest util-linux 2.35.1 unless you'd prefer some intermediate version.
Thank you,

..mark
--- origsrc/util-linux-2.33.1/lib/cpuset.c      2018-06-04 00:57:02.792445800 
-0700
+++ src/util-linux-2.33.1/lib/cpuset.c  2020-01-11 00:37:39.126054200 -0800
@@ -60,7 +60,7 @@ static const char *nexttoken(const char
  */
 int get_max_number_of_cpus(void)
 {
-#ifdef SYS_sched_getaffinity
+#if defined(SYS_sched_getaffinity) || defined(__CYGWIN__)
        int n, cpus = 2048;
        size_t setsize;
        cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL);
@@ -72,7 +72,11 @@ int get_max_number_of_cpus(void)
                CPU_ZERO_S(setsize, set);
 
                /* the library version does not return size of cpumask_t */
+#if defined(__CYGWIN__)
+               n = __sched_getaffinity_sys(0, setsize, set);
+#else
                n = syscall(SYS_sched_getaffinity, 0, setsize, set);
+#endif
 
                if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) {
                        cpuset_free(set);

Reply via email to