aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2011-09-16 11:18:49 +0200
committerRaimo Niskanen <[email protected]>2011-11-17 12:11:03 +0100
commite6b246fa68a6ae09f1fab60086a20caf9a4f4f19 (patch)
tree872d3e9518e9c7896c5cfee9d504acb93f10184d /erts/emulator/drivers/common
parentd661742424dfa8ecbc2797845b810383c356b268 (diff)
downloadotp-e6b246fa68a6ae09f1fab60086a20caf9a4f4f19.tar.gz
otp-e6b246fa68a6ae09f1fab60086a20caf9a4f4f19.tar.bz2
otp-e6b246fa68a6ae09f1fab60086a20caf9a4f4f19.zip
erts: Use SCTP functions in default libs
On e.g FreeBSD the functions sctp_bindx() and sctp_peeloff() do not require any extra linkage library flags and there is no dynamic lib to load for them; use configure to find them.
Diffstat (limited to 'erts/emulator/drivers/common')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index bab31951a5..097fe78e19 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -294,7 +294,6 @@ static unsigned long one_value = 1;
# define sctp_adaptation_layer_event sctp_adaption_layer_event
#endif
-static void *h_libsctp = NULL;
#ifdef __GNUC__
static typeof(sctp_bindx) *p_sctp_bindx = NULL;
static typeof(sctp_peeloff) *p_sctp_peeloff = NULL;
@@ -3467,20 +3466,32 @@ static int inet_init()
/* Check the size of SCTP AssocID -- currently both this driver and the
Erlang part require 32 bit: */
ASSERT(sizeof(sctp_assoc_t)==ASSOC_ID_LEN);
-# ifndef LIBSCTP
-# error LIBSCTP not defined
-# endif
- if (erts_sys_ddll_open_noext(STRINGIFY(LIBSCTP), &h_libsctp, NULL) == 0) {
- void *ptr;
- if (erts_sys_ddll_sym(h_libsctp, "sctp_bindx", &ptr) == 0) {
- p_sctp_bindx = ptr;
- inet_init_sctp();
- add_driver_entry(&sctp_inet_driver_entry);
- if (erts_sys_ddll_sym(h_libsctp, "sctp_peeloff", &ptr) == 0) {
- p_sctp_peeloff = ptr;
+# if defined(HAVE_SCTP_BINDX) && defined (HAVE_SCTP_PEELOFF)
+ p_sctp_bindx = sctp_bindx;
+ p_sctp_peeloff = sctp_peeloff;
+ inet_init_sctp();
+ add_driver_entry(&sctp_inet_driver_entry);
+# else
+# ifndef LIBSCTP
+# error LIBSCTP not defined
+# endif
+ {
+ static void *h_libsctp = NULL;
+
+ if (erts_sys_ddll_open_noext(STRINGIFY(LIBSCTP), &h_libsctp, NULL)
+ == 0) {
+ void *ptr;
+ if (erts_sys_ddll_sym(h_libsctp, "sctp_bindx", &ptr) == 0) {
+ p_sctp_bindx = ptr;
+ inet_init_sctp();
+ add_driver_entry(&sctp_inet_driver_entry);
+ if (erts_sys_ddll_sym(h_libsctp, "sctp_peeloff", &ptr) == 0) {
+ p_sctp_peeloff = ptr;
+ }
}
}
}
+# endif
#endif
/* remove the dummy inet driver */