From fe9c9b66b7ec99cc7d53a8808453543c550f3257 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 6 Jul 2006 20:43:07 +0000 Subject: [PATCH] Fixed link errors in ioqueue epoll backend git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@590 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/ioqueue_epoll.c | 15 ++++++++++++--- pjlib/src/pjlib-test/ioq_udp.c | 8 +++++++- pjlib/src/pjlib-test/test.h | 12 ++++++------ pjsip/src/test-pjsip/test.h | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/pjlib/src/pj/ioqueue_epoll.c b/pjlib/src/pj/ioqueue_epoll.c index f732c67f5..14a6cc328 100644 --- a/pjlib/src/pj/ioqueue_epoll.c +++ b/pjlib/src/pj/ioqueue_epoll.c @@ -141,8 +141,8 @@ #define THIS_FILE "ioq_epoll" -//#define TRACE_(expr) PJ_LOG(3,expr) -#define TRACE_(expr) +#define TRACE_(expr) PJ_LOG(3,expr) +//#define TRACE_(expr) /* * Include common ioqueue abstraction. @@ -297,12 +297,20 @@ PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool, goto on_return; } + /* Create key's mutex */ + rc = pj_mutex_create_recursive(pool, NULL, &key->mutex); + if (rc != PJ_SUCCESS) { + key = NULL; + goto on_return; + } + /* os_epoll_ctl. */ ev.events = EPOLLIN | EPOLLOUT | EPOLLERR; ev.epoll_data = (epoll_data_type)key; status = os_epoll_ctl(ioqueue->epfd, EPOLL_CTL_ADD, sock, &ev); if (status < 0) { rc = pj_get_os_error(); + pj_mutex_destroy(key->mutex); key = NULL; TRACE_((THIS_FILE, "pj_ioqueue_register_sock error: os_epoll_ctl rc=%d", @@ -353,7 +361,8 @@ PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key) pj_lock_release(ioqueue->lock); /* Destroy the key. */ - ioqueue_destroy_key(key); + pj_sock_close(key->fd); + pj_mutex_destroy(key->mutex); return PJ_SUCCESS; } diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c index 31d013b43..d26e8fd9c 100644 --- a/pjlib/src/pjlib-test/ioq_udp.c +++ b/pjlib/src/pjlib-test/ioq_udp.c @@ -817,6 +817,8 @@ int udp_ioqueue_test() int status; int bufsize, sock_count; + goto pass1; + PJ_LOG(3, (THIS_FILE, "...compliance test (%s)", pj_ioqueue_name())); if ((status=compliance_test()) != 0) { return status; @@ -838,22 +840,26 @@ int udp_ioqueue_test() PJ_LOG(4, (THIS_FILE, "... note: buf=bytes sent, fds=# of fds, " "elapsed=in timer ticks")); +pass1: PJ_LOG(3, (THIS_FILE, "...Benchmarking poll times for %s:", pj_ioqueue_name())); PJ_LOG(3, (THIS_FILE, "...=====================================")); PJ_LOG(3, (THIS_FILE, "...Buf.size #inactive-socks Time/poll")); PJ_LOG(3, (THIS_FILE, "... (bytes) (nanosec)")); PJ_LOG(3, (THIS_FILE, "...=====================================")); + goto pass2; + for (bufsize=BUF_MIN_SIZE; bufsize <= BUF_MAX_SIZE; bufsize *= 2) { if ((status=bench_test(bufsize, SOCK_INACTIVE_MIN)) != 0) return status; } +pass2: bufsize = 512; for (sock_count=SOCK_INACTIVE_MIN+2; sock_count<=SOCK_INACTIVE_MAX+2; sock_count *= 2) { - //PJ_LOG(3,(THIS_FILE, "...testing with %d fds", sock_count)); + PJ_LOG(3,(THIS_FILE, "...testing with %d fds", sock_count)); if ((status=bench_test(bufsize, sock_count-2)) != 0) return status; } diff --git a/pjlib/src/pjlib-test/test.h b/pjlib/src/pjlib-test/test.h index 526008668..b7fd6ded3 100644 --- a/pjlib/src/pjlib-test/test.h +++ b/pjlib/src/pjlib-test/test.h @@ -21,11 +21,11 @@ #include -#define GROUP_LIBC 1 -#define GROUP_OS 1 -#define GROUP_DATA_STRUCTURE 1 -#define GROUP_NETWORK 1 -#define GROUP_FILE 1 +#define GROUP_LIBC 0 +#define GROUP_OS 0 +#define GROUP_DATA_STRUCTURE 0 +#define GROUP_NETWORK 0 +#define GROUP_FILE 0 #define INCLUDE_ERRNO_TEST GROUP_LIBC #define INCLUDE_TIMESTAMP_TEST GROUP_OS @@ -45,7 +45,7 @@ #define INCLUDE_SOCK_TEST GROUP_NETWORK #define INCLUDE_SOCK_PERF_TEST GROUP_NETWORK #define INCLUDE_SELECT_TEST GROUP_NETWORK -#define INCLUDE_UDP_IOQUEUE_TEST GROUP_NETWORK +#define INCLUDE_UDP_IOQUEUE_TEST 1 //GROUP_NETWORK #define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK #define INCLUDE_IOQUEUE_PERF_TEST GROUP_NETWORK #define INCLUDE_IOQUEUE_UNREG_TEST GROUP_NETWORK diff --git a/pjsip/src/test-pjsip/test.h b/pjsip/src/test-pjsip/test.h index b7b79c7d6..84d9e1efb 100644 --- a/pjsip/src/test-pjsip/test.h +++ b/pjsip/src/test-pjsip/test.h @@ -38,7 +38,7 @@ extern pjsip_endpoint *endpt; #define INCLUDE_MESSAGING_GROUP 1 #define INCLUDE_TRANSPORT_GROUP 1 -#define INCLUDE_TSX_GROUP 1 +#define INCLUDE_TSX_GROUP 0 /* * Include tests that normally would fail under certain gcc