Module: kamailio
Branch: master
Commit: fedde6e9b4916080399ff7a8a587815aab622c7e
URL: 
https://github.com/kamailio/kamailio/commit/fedde6e9b4916080399ff7a8a587815aab622c7e

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2016-02-22T23:17:47+01:00

Merge pull request #517 from mslehto/openbsd

OpenBSD fixes

---

Modified: Makefile.defs
Modified: sr_module.c
Modified: tcp_options.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/fedde6e9b4916080399ff7a8a587815aab622c7e.diff
Patch: 
https://github.com/kamailio/kamailio/commit/fedde6e9b4916080399ff7a8a587815aab622c7e.patch

---

diff --git a/Makefile.defs b/Makefile.defs
index 226b68a..5495343 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -1844,7 +1844,8 @@ ifeq ($(OS), openbsd)
        C_DEFS+=-DHAVE_SOCKADDR_SA_LEN  -DHAVE_GETHOSTBYNAME2 \
                -DHAVE_UNION_SEMUN -DHAVE_MSGHDR_MSG_CONTROL \
                -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
-               -DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT
+               -DHAVE_NETINET_IN_SYSTM -DUSE_SIGWAIT \
+               -DHAVE_SCHED_YIELD
        ifneq ($(found_lock_method), yes)
                C_DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
                found_lock_method=yes
@@ -1860,25 +1861,8 @@ ifeq ($(OS), openbsd)
        endif
        # (symbols on openbsd are prefixed by "_")
        YACC=yacc
-       # no sched_yield on openbsd unless linking with c_r (not recommended)
        # unfortunately pthread is needed for sigwait
        LIBS= -lpthread
-       OPENBSD_IS_AOUT:= $(shell echo "$(OSREL)" | \
-                               sed -e 's/^3\.[0-3][^0-9]*$$/yes/' |sed -e 
's/^[0-2]\..*/yes/')
-# exception: on sparc openbsd 3.2 is elf and not aout
-ifeq ($(OSREL), 3.2)
-ifeq   ($(ARCH), sparc)
-               OPENBSD_IS_AOUT:=no
-endif
-ifeq   ($(ARCH), sparc64)
-               OPENBSD_IS_AOUT:=no
-endif
-endif
-       
-ifeq ($(OPENBSD_IS_AOUT), yes)
-               C_DEFS+=-DDLSYM_PREFIX='"_"'
-               LDFLAGS=        # openbsd ld doesn't like -O2 or -E
-endif
 endif   # if opensd
        
 ifeq ($(OS), netbsd)
diff --git a/sr_module.c b/sr_module.c
index 057bf02..6ddbd00 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -381,23 +381,18 @@ static int register_module(unsigned ver, union 
module_exports_u* e,
        return ret;
 }
 
-#ifndef DLSYM_PREFIX
-/* define it to null */
-#define DLSYM_PREFIX
-#endif
-
 static inline int version_control(void *handle, char *path)
 {
        char **m_ver;
        char **m_flags;
        char* error;
 
-       m_ver=(char **)dlsym(handle, DLSYM_PREFIX "module_version");
+       m_ver=(char **)dlsym(handle, "module_version");
        if ((error=(char *)dlerror())!=0) {
                LM_ERR("no version info in module <%s>: %s\n", path, error);
                return 0;
        }
-       m_flags=(char **)dlsym(handle, DLSYM_PREFIX "module_flags");
+       m_flags=(char **)dlsym(handle, "module_flags");
        if ((error=(char *)dlerror())!=0) {
                LM_ERR("no compile flags info in module <%s>: %s\n", path, 
error);
                return 0;
@@ -587,14 +582,13 @@ int load_module(char* mod_path)
        if (!version_control(handle, path)) {
                exit(-1);
        }
-       mod_if_ver = (unsigned *)dlsym(handle,
-                                                                       
DLSYM_PREFIX "module_interface_ver");
+       mod_if_ver = (unsigned *)dlsym(handle, "module_interface_ver");
        if ( (error =(char*)dlerror())!=0 ){
                LM_ERR("no module interface version in module <%s>\n", path );
                goto error1;
        }
        /* launch register */
-       mr = (mod_register_function)dlsym(handle, DLSYM_PREFIX "mod_register");
+       mr = (mod_register_function)dlsym(handle, "mod_register");
        if (((error =(char*)dlerror())==0) && mr) {
                /* no error call it */
                new_dlflags=dlflags;
@@ -612,7 +606,7 @@ int load_module(char* mod_path)
                        goto error;
                }
        }
-       exp = (union module_exports_u*)dlsym(handle, DLSYM_PREFIX "exports");
+       exp = (union module_exports_u*)dlsym(handle, "exports");
        if(exp==NULL) {
                /* 'exports' structure not found, look up for 
'_modulename_exports' */
                mdir = strrchr(mod_path, '/');
@@ -624,7 +618,7 @@ int load_module(char* mod_path)
                expref.len = strlen(expref.s);
                if(expref.len>3 && strcmp(expref.s+expref.len-3, ".so")==0)
                        expref.len -= 3;
-               snprintf(exbuf, 62, DLSYM_PREFIX "_%.*s_exports", expref.len, 
expref.s);
+               snprintf(exbuf, 62, "_%.*s_exports", expref.len, expref.s);
                exp = (union module_exports_u*)dlsym(handle, exbuf);
                LM_DBG("looking up exports with name: %s\n", exbuf);
                if ( (error =(char*)dlerror())!=0 ){
diff --git a/tcp_options.h b/tcp_options.h
index d8da5f3..2509f87 100644
--- a/tcp_options.h
+++ b/tcp_options.h
@@ -23,6 +23,7 @@
 
 #ifdef USE_TCP
 
+#include <netinet/in.h>
 #include <netinet/tcp.h>
 #ifndef NO_TCP_ASYNC
 #define TCP_ASYNC /* enabled async mode */


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to