]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: check {malloc,pthread}_np.h for *BSD
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 4 Sep 2018 10:24:22 +0000 (12:24 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 23:16:25 +0000 (01:16 +0200)
FreeBSD has malloc_usable_size() in malloc_np.h
OpenBSD has pthread_set_name_np() in pthread_np.h

Signed-off-by: David Lamparter <equinox@diac24.net>
configure.ac
lib/frr_pthread.c
lib/memory.c

index e6ca7d95893ee5ff1732fac5109e9b31212543a4..779c7ebb6a12eeefddbed5aca1a1c275a3a7840b 100755 (executable)
@@ -815,6 +815,10 @@ int main(int argc, char **argv) {
   ])
 ])
 
+AC_CHECK_HEADERS([pthread_np.h],,, [
+#include <pthread.h>
+])
+
 dnl Utility macro to avoid retyping includes all the time
 m4_define([FRR_INCLUDES],
 [#ifdef SUNOS_5
@@ -1784,13 +1788,16 @@ dnl order to check no alternative allocator
 dnl has been specified, which might not provide
 dnl mallinfo, e.g. such as Umem on Solaris.
 dnl -----------------------------------------
-AC_CHECK_HEADERS([malloc.h malloc/malloc.h],,, [FRR_INCLUDES])
+AC_CHECK_HEADERS([malloc.h malloc_np.h malloc/malloc.h],,, [FRR_INCLUDES])
 
 AC_CACHE_CHECK([whether mallinfo is available], [frr_cv_mallinfo], [
   AC_LINK_IFELSE([AC_LANG_PROGRAM([FRR_INCLUDES [
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
 #endif
+#ifdef HAVE_MALLOC_NP_H
+#include <malloc_np.h>
+#endif
 #ifdef HAVE_MALLOC_MALLOC_H
 #include <malloc/malloc.h>
 #endif
index c0aae5e52e098e6da07bc72bdc459bc453440daa..7cae889ca9b83461ea291bcb0913877b31fff6d9 100644 (file)
@@ -19,6 +19,9 @@
 
 #include <zebra.h>
 #include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
 #include <sched.h>
 
 #include "frr_pthread.h"
index 695bbfe11572e85b046319c6d5e083f5250e91c9..fee23a75ac67e1d11463c102b2e68a87444ba1b5 100644 (file)
@@ -20,6 +20,9 @@
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
 #endif
+#ifdef HAVE_MALLOC_NP_H
+#include <malloc_np.h>
+#endif
 #ifdef HAVE_MALLOC_MALLOC_H
 #include <malloc/malloc.h>
 #endif