diff options
author | alaviss <[email protected]> | 2017-08-30 00:17:49 +0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-08-29 10:17:49 -0700 |
commit | 1ea8942faa90c1787f3ad1bda44dc26bfc3186da (patch) | |
tree | 0679acfa19a22d43d325e1331d4aed264a7c966e /lib | |
parent | 0d3980acbcca00f495926a1d6b0886e0ea1f6589 (diff) |
libtpool: don't clone affinity if not supported
pthread_attr_(get/set)affinity_np() is glibc-only. This commit
disable the code path that use those functions in non-glibc
system. Fixes the following when building with musl:
libzfs.so: undefined reference to`pthread_attr_setaffinity_np'
libzfs.so: undefined reference to`pthread_attr_getaffinity_np'
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Leorize <[email protected]>
Closes #6571
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtpool/thread_pool.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libtpool/thread_pool.c b/lib/libtpool/thread_pool.c index 166ce3e67..a43fdd9cd 100644 --- a/lib/libtpool/thread_pool.c +++ b/lib/libtpool/thread_pool.c @@ -252,6 +252,7 @@ pthread_attr_clone(pthread_attr_t *attr, const pthread_attr_t *old_attr) if (error || (old_attr == NULL)) return (error); +#ifdef __GLIBC__ cpu_set_t cpuset; size_t cpusetsize = sizeof (cpuset); error = pthread_attr_getaffinity_np(old_attr, cpusetsize, &cpuset); @@ -259,6 +260,7 @@ pthread_attr_clone(pthread_attr_t *attr, const pthread_attr_t *old_attr) error = pthread_attr_setaffinity_np(attr, cpusetsize, &cpuset); if (error) goto error; +#endif /* __GLIBC__ */ int detachstate; error = pthread_attr_getdetachstate(old_attr, &detachstate); |