]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the build on NetBSD due to the differences in pthread implementation.
authorHåvard Eidnes <he@uninett.no>
Thu, 22 Nov 2018 14:15:11 +0000 (15:15 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 22 Nov 2018 14:43:43 +0000 (09:43 -0500)
Signed-off-by: Ondřej Surý <ondrej@sury.org>
configure
configure.ac
lib/isc/pthreads/thread.c

index cc87bb0b485f2a8329757b75f45bb6b47131d1b8..ea6a4d81db5960c3e8d16ba71d86c51672eb21e4 100755 (executable)
--- a/configure
+++ b/configure
@@ -20332,7 +20332,7 @@ else
 
 fi
                ;; #(
-  *-freebsd*|*-openbsd*) :
+  *-freebsd*|*-openbsd*|*-netbsd*) :
 
                 LDFLAGS="${LDFLAGS} -Wl,-E"
                 SO_CFLAGS="-fpic"
@@ -20348,13 +20348,6 @@ else
 
 fi
                ;; #(
-  *-netbsd*) :
-
-                SO_CFLAGS="-fpic"
-                SO_LDFLAGS="-Bshareable -x"
-                SO_LD="ld"
-                SO_STRIP="sed -e s/-Wl,//g"
-               ;; #(
   *-solaris*) :
 
                 SO_CFLAGS="-KPIC"
index 41d82d77c52349f359fef479868fc844a245e74d..d8c3edf71a831c9d5626ac17cf31c5e189ddf009 100644 (file)
@@ -2697,7 +2697,7 @@ AS_IF([test "$with_dlopen" = "yes"],
                         SO_LD="${CC}"
                       ])
               ],
-              [*-freebsd*|*-openbsd*],[
+              [*-freebsd*|*-openbsd*|*-netbsd*],[
                 LDFLAGS="${LDFLAGS} -Wl,-E"
                 SO_CFLAGS="-fpic"
                 AS_IF([test "$use_libtool" = "yes"],[
@@ -2708,12 +2708,6 @@ AS_IF([test "$with_dlopen" = "yes"],
                         SO_LD="${CC}"
                       ])
               ],
-              [*-netbsd*],[
-                SO_CFLAGS="-fpic"
-                SO_LDFLAGS="-Bshareable -x"
-                SO_LD="ld"
-                SO_STRIP="sed -e s/-Wl,//g"
-              ],
               [*-solaris*],[
                 SO_CFLAGS="-KPIC"
                 SO_LDFLAGS="-G -z text"
index b882838f8c3f7d99ff385e547346428bad12a1fe..c40ccf1e5d4f618f6cc8dc71cf66231d72b66cbb 100644 (file)
@@ -71,6 +71,10 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
        return (ISC_R_SUCCESS);
 }
 
+#ifdef __NetBSD__
+#define pthread_setconcurrency(a)      (void) a/* nothing */
+#endif
+
 void
 isc_thread_setconcurrency(unsigned int level) {
        (void)pthread_setconcurrency(level);
@@ -83,7 +87,11 @@ isc_thread_setname(isc_thread_t thread, const char *name) {
         * macOS has pthread_setname_np but only works on the
         * current thread so it's not used here
        */
+#if defined(__NetBSD__)
+       (void)pthread_setname_np(thread, name, NULL);
+#else
        (void)pthread_setname_np(thread, name);
+#endif
 #elif defined(HAVE_PTHREAD_SET_NAME_NP)
        (void)pthread_set_name_np(thread, name);
 #else
@@ -115,6 +123,20 @@ isc_thread_setaffinity(int cpu) {
                return (ISC_R_FAILURE);
        }
 #elif defined(HAVE_PTHREAD_SETAFFINITY_NP)
+#if defined(__NetBSD__)
+       cpuset_t *cset;
+       cset = cpuset_create();
+       if (cset == NULL)
+               return (ISC_R_FAILURE);
+       cpuset_set(cpu, cset);
+       if (pthread_setaffinity_np(pthread_self(),
+               cpuset_size(cset), cset) != 0)
+       {
+               cpuset_destroy(cset);
+               return (ISC_R_FAILURE);
+       }
+       cpuset_destroy(cset);
+#else /* linux? */
        cpu_set_t set;
        CPU_ZERO(&set);
        CPU_SET(cpu, &set);
@@ -123,6 +145,7 @@ isc_thread_setaffinity(int cpu) {
        {
                return (ISC_R_FAILURE);
        }
+#endif /* __NetBSD__ */
 #elif defined(HAVE_PROCESSOR_BIND)
        if (processor_bind(P_LWPID, P_MYID, cpu, NULL) != 0) {
                return (ISC_R_FAILURE);