osaf/libs/agents/saf/lga/lga_api.c | 2 +- osaf/libs/agents/saf/lga/lga_util.c | 7 ++----- osaf/tools/saflog/saflogger/saf_logger.c | 1 - tests/logsv/Makefile.am | 6 ++++-- 4 files changed, 7 insertions(+), 9 deletions(-)
The select() function cannot handle file descriptors larger than 1023. To avoid this limitation, we replace all usages of select() with poll(). diff --git a/osaf/libs/agents/saf/lga/lga_api.c b/osaf/libs/agents/saf/lga/lga_api.c --- a/osaf/libs/agents/saf/lga/lga_api.c +++ b/osaf/libs/agents/saf/lga/lga_api.c @@ -224,7 +224,7 @@ SaAisErrorT saLogInitialize(SaLogHandleT * allows a process to avoid repeated invoking saLogDispatch() to see if * there is a new event, thus, needlessly consuming CPU time. In a POSIX * environment the system handle could be a file descriptor that is used with - * the poll() or select() system calls to detect incoming callbacks. + * the poll() system call to detect incoming callbacks. * * * Parameters diff --git a/osaf/libs/agents/saf/lga/lga_util.c b/osaf/libs/agents/saf/lga/lga_util.c --- a/osaf/libs/agents/saf/lga/lga_util.c +++ b/osaf/libs/agents/saf/lga/lga_util.c @@ -18,6 +18,7 @@ #include <stdlib.h> #include <syslog.h> #include "lga.h" +#include "osaf_poll.h" /* Variables used during startup/shutdown only */ static pthread_mutex_t lga_lock = PTHREAD_MUTEX_INITIALIZER; @@ -30,14 +31,10 @@ static unsigned int lga_use_count; */ static unsigned int lga_create(void) { - unsigned int timeout = 3000; - NCS_SEL_OBJ_SET set; unsigned int rc = NCSCC_RC_SUCCESS; /* create and init sel obj for mds sync */ m_NCS_SEL_OBJ_CREATE(&lga_cb.lgs_sync_sel); - m_NCS_SEL_OBJ_ZERO(&set); - m_NCS_SEL_OBJ_SET(lga_cb.lgs_sync_sel, &set); lga_cb.lgs_sync_awaited = 1; /* register with MDS */ @@ -47,7 +44,7 @@ static unsigned int lga_create(void) } /* Block and wait for indication from MDS meaning LGS is up */ - m_NCS_SEL_OBJ_SELECT(lga_cb.lgs_sync_sel, &set, 0, 0, &timeout); + osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(lga_cb.lgs_sync_sel), 30000); pthread_mutex_lock(&lga_cb.cb_lock); lga_cb.lgs_sync_awaited = 0; diff --git a/osaf/tools/saflog/saflogger/saf_logger.c b/osaf/tools/saflog/saflogger/saf_logger.c --- a/osaf/tools/saflog/saflogger/saf_logger.c +++ b/osaf/tools/saflog/saflogger/saf_logger.c @@ -29,7 +29,6 @@ #include <getopt.h> #include <sys/types.h> #include <sys/socket.h> -#include <sys/select.h> #include <sys/un.h> #include <sys/time.h> #include <fcntl.h> diff --git a/tests/logsv/Makefile.am b/tests/logsv/Makefile.am --- a/tests/logsv/Makefile.am +++ b/tests/logsv/Makefile.am @@ -51,11 +51,13 @@ logtest_SOURCES = \ logtest_LDADD = \ $(top_builddir)/osaf/libs/saf/libSaLog/libSaLog.la \ $(top_builddir)/osaf/libs/saf/libSaImm/libSaImmOi.la \ - $(top_builddir)/osaf/libs/saf/libSaImm/libSaImmOm.la + $(top_builddir)/osaf/libs/saf/libSaImm/libSaImmOm.la \ + $(top_builddir)/osaf/libs/core/libopensaf_core.la saflogtest_SOURCES = \ saflogtest.c saflogtest_LDADD = \ - $(top_builddir)/osaf/libs/saf/libSaLog/libSaLog.la + $(top_builddir)/osaf/libs/saf/libSaLog/libSaLog.la \ + $(top_builddir)/osaf/libs/core/libopensaf_core.la ------------------------------------------------------------------------------ Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel