]> granicus.if.org Git - zfs/commitdiff
libtpool: don't clone affinity if not supported
authoralaviss <alaviss@users.noreply.github.com>
Tue, 29 Aug 2017 17:17:49 +0000 (00:17 +0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 29 Aug 2017 17:17:49 +0000 (10:17 -0700)
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 <behlendorf1@llnl.gov>
Signed-off-by: Leorize <alaviss@users.noreply.github.com>
Closes #6571

lib/libtpool/thread_pool.c

index 166ce3e672e165e98419b333954695a513dfd0c5..a43fdd9cd6085855a7e17037a558ff5ccc35aafc 100644 (file)
@@ -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);