Initial OpenBSD fixes (#994):
pjlib: - Autoconf fixes in detecting header availability - Undefined sched_get_priority_max() and sched_get_priority_min() - protect with #ifdef _POSIX_PRIORITY_SCHEDULING, and - return hardcoded (0, 31) if __OpenBSD__ macro is declared - Better GUID generation pjlib-test: - Reduce the loop in PJILB activesock test - Fixed bug in ioqueue unregistration test which caused assertion error in destroying mutex pjlib-util-test: - Fixed bug in pjlib-util resolver test git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3057 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
7d1f7686b2
commit
d523370d48
6338
aconfigure
6338
aconfigure
File diff suppressed because it is too large
Load Diff
|
@ -146,9 +146,15 @@ AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
|
|||
AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
|
||||
AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
|
||||
AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
|
||||
[#if PJ_HAS_NETINET_IN_SYSTM_H
|
||||
[#if PJ_HAS_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if PJ_HAS_NETINET_IN_SYSTM_H
|
||||
# include <netinet/in_systm.h>
|
||||
#endif
|
||||
#if PJ_HAS_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
])
|
||||
AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
|
||||
AC_CHECK_HEADER(ifaddrs.h,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])
|
||||
|
@ -180,11 +186,14 @@ AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
|
|||
AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
|
||||
AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
|
||||
AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
|
||||
[#if PJ_HAS_SYS_SOCKET_H
|
||||
[#if PJ_HAS_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if PJ_HAS_SYS_SOCKET_H
|
||||
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
|
||||
AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
|
||||
|
||||
|
@ -256,7 +265,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
|||
|
||||
dnl # Determine if socklen_t is available
|
||||
AC_MSG_CHECKING([if socklen_t is available])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <sys/socket.h>]],
|
||||
[socklen_t xxx = 0;])],
|
||||
[AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
|
||||
AC_MSG_RESULT(yes)],
|
||||
|
@ -754,8 +764,8 @@ AC_ARG_ENABLE(ssl,
|
|||
AC_SUBST(libssl_present)
|
||||
AC_SUBST(libcrypto_present)
|
||||
AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
|
||||
AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
|
||||
AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
|
||||
AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
|
||||
if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
|
||||
AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
|
||||
# PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
|
||||
|
|
|
@ -813,8 +813,8 @@ static int dns_test(void)
|
|||
/* Now only server 0 should get packet, since both servers are
|
||||
* in STATE_ACTIVE state
|
||||
*/
|
||||
pj_assert(g_server[0].pkt_count == 1);
|
||||
pj_assert(g_server[1].pkt_count == 0);
|
||||
pj_assert((g_server[0].pkt_count == 1 && g_server[1].pkt_count == 0) ||
|
||||
(g_server[1].pkt_count == 1 && g_server[0].pkt_count == 0));
|
||||
|
||||
/* Wait to allow probing period to complete */
|
||||
PJ_LOG(3,(THIS_FILE, " waiting for active NS to expire (%d sec)",
|
||||
|
|
|
@ -67,10 +67,12 @@ PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t *str)
|
|||
pj_assert(PJ_GUID_STRING_LENGTH % 2 == 0);
|
||||
|
||||
for (p=str->ptr, end=p+PJ_GUID_STRING_LENGTH; p<end; ) {
|
||||
/* Assumes rand() only has 16bit randomness */
|
||||
unsigned short val = pj_rand();
|
||||
*p++ = guid_chars[(val >> 8) & 63];
|
||||
*p++ = guid_chars[(val & 0xFF) & 63];
|
||||
pj_uint32_t rand_val = pj_rand();
|
||||
pj_uint32_t rand_idx = RAND_MAX;
|
||||
|
||||
for ( ; rand_idx>0 && p<end; rand_idx>>=8, rand_val>>=8, p++) {
|
||||
*p = guid_chars[(rand_val & 0xFF) & 63];
|
||||
}
|
||||
}
|
||||
|
||||
str->slen = PJ_GUID_STRING_LENGTH;
|
||||
|
|
|
@ -308,7 +308,14 @@ PJ_DEF(int) pj_thread_get_prio_min(pj_thread_t *thread)
|
|||
if (rc != 0)
|
||||
return -1;
|
||||
|
||||
#if defined _POSIX_PRIORITY_SCHEDULING
|
||||
return sched_get_priority_min(policy);
|
||||
#elif defined __OpenBSD__
|
||||
return 0;
|
||||
#else
|
||||
pj_assert("pj_thread_get_prio_min() not supported!");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,7 +332,14 @@ PJ_DEF(int) pj_thread_get_prio_max(pj_thread_t *thread)
|
|||
if (rc != 0)
|
||||
return -1;
|
||||
|
||||
#if defined _POSIX_PRIORITY_SCHEDULING
|
||||
return sched_get_priority_max(policy);
|
||||
#elif defined __OpenBSD__
|
||||
return 31;
|
||||
#else
|
||||
pj_assert("pj_thread_get_prio_max() not supported!");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ static pj_bool_t tcp_on_data_sent(pj_activesock_t *asock,
|
|||
|
||||
static int tcp_perf_test(void)
|
||||
{
|
||||
enum { COUNT=100000 };
|
||||
enum { COUNT=10000 };
|
||||
pj_pool_t *pool = NULL;
|
||||
pj_ioqueue_t *ioqueue = NULL;
|
||||
pj_sock_t sock1=PJ_INVALID_SOCKET, sock2=PJ_INVALID_SOCKET;
|
||||
|
@ -436,6 +436,15 @@ static int tcp_perf_test(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PJ_SYMBIAN
|
||||
for (;;) {
|
||||
pj_time_val timeout = {0, 10};
|
||||
if (pj_ioqueue_poll(ioqueue, &timeout) < 1)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* Wait until everything has been sent/received */
|
||||
|
|
|
@ -93,6 +93,7 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
|||
if (PJ_TIME_VAL_GTE(now, time_to_unregister)) {
|
||||
sock_data.unregistered = 1;
|
||||
pj_ioqueue_unregister(key);
|
||||
pj_mutex_unlock(sock_data.mutex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue