Re: [PATCH] Fix non-Linux build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 08, 2012 at 05:19:43PM +0200, Samuel Thibault wrote:
> --- a/lib/cpuset.c
> +++ b/lib/cpuset.c
> @@ -54,6 +54,7 @@ static const char *nexttoken(const char *q,  int sep)
>  	return q;
>  }
>  
> +#ifdef __linux__
>  /*
>   * Number of bits in a CPU bitmask on current system
>   */
> @@ -85,6 +86,7 @@ int get_max_number_of_cpus(void)
>  	}
>  	return -1;
>  }
> +#endif

 Hmm... this not too elegant for the internal API. I have modified the
 patch:

--- a/lib/cpuset.c
+++ b/lib/cpuset.c
@@ -59,6 +59,7 @@ static const char *nexttoken(const char *q,  int sep)
  */
 int get_max_number_of_cpus(void)
 {
+#ifdef SYS_sched_getaffinity
        int n, cpus = 2048;
        size_t setsize;
        cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL);
@@ -83,6 +84,7 @@ int get_max_number_of_cpus(void)
                cpuset_free(set);
                return n * 8;
        }
+#endif
        return -1;
 }


... so the function always exist. I guess the syscall is Linux
specific.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux