socket_wrapper.c/tests: fall back to pragma init/fini for constructor/destructor...
authorBjörn Jacke <bjacke@samba.org>
Fri, 30 Oct 2020 14:44:53 +0000 (15:44 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 4 Nov 2020 15:39:54 +0000 (16:39 +0100)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/socket_wrapper.c
tests/thread_deadlock.c

index ffdd31a51bfdec2b1ce4fa5a8be2cf175fc55543..35d61b52bb0500a32d226a91839045dcbb13ccf3 100644 (file)
@@ -334,7 +334,14 @@ static pthread_mutex_t mtu_update_mutex;
 
 bool socket_wrapper_enabled(void);
 
+#if ! defined(HAVE_CONSTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_INIT)
+/* xlC and other oldschool compilers support (only) this */
+#pragma init (swrap_constructor)
+#endif
 void swrap_constructor(void) CONSTRUCTOR_ATTRIBUTE;
+#if ! defined(HAVE_DESTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_FINI)
+#pragma fini (swrap_destructor)
+#endif
 void swrap_destructor(void) DESTRUCTOR_ATTRIBUTE;
 
 #ifndef HAVE_GETPROGNAME
index b72367f5d9e849323b21644824ad7839ff8e47b2..6c58af316c80845595322a9d3785da194d092de8 100644 (file)
 #else
 #define CONSTRUCTOR_ATTRIBUTE
 #endif /* HAVE_CONSTRUCTOR_ATTRIBUTE */
-
+#if ! defined(HAVE_CONSTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_INIT)
+/* xlC and other oldschool compilers support (only) this */
+#pragma init (thread_deadlock_constructor)
+#endif
 void thread_deadlock_constructor(void) CONSTRUCTOR_ATTRIBUTE;
 
 static void thread_deadlock_prepare(void)