osaf/libs/agents/saf/ntfa/ntfa_api.c | 2 +- osaf/libs/agents/saf/ntfa/ntfa_util.c | 8 +++----- osaf/tools/safntf/ntfread/ntfread.c | 1 - osaf/tools/safntf/ntfsend/ntfsend.c | 1 - osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c | 1 - tests/ntfsv/Makefile.am | 3 ++- 6 files changed, 6 insertions(+), 10 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/ntfa/ntfa_api.c b/osaf/libs/agents/saf/ntfa/ntfa_api.c --- a/osaf/libs/agents/saf/ntfa/ntfa_api.c +++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c @@ -809,7 +809,7 @@ SaAisErrorT saNtfInitialize(SaNtfHandleT * allows a process to avoid repeated invoking saNtfDispatch() 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/ntfa/ntfa_util.c b/osaf/libs/agents/saf/ntfa/ntfa_util.c --- a/osaf/libs/agents/saf/ntfa/ntfa_util.c +++ b/osaf/libs/agents/saf/ntfa/ntfa_util.c @@ -20,6 +20,8 @@ #include "ntfa.h" #include "ntfsv_enc_dec.h" #include "ntfsv_mem.h" +#include "osaf_utility.h" +#include "osaf_poll.h" /* Variables used during startup/shutdown only */ static pthread_mutex_t ntfa_lock = PTHREAD_MUTEX_INITIALIZER; @@ -32,14 +34,10 @@ static unsigned int ntfa_use_count; */ static unsigned int ntfa_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(&ntfa_cb.ntfs_sync_sel); - m_NCS_SEL_OBJ_ZERO(&set); - m_NCS_SEL_OBJ_SET(ntfa_cb.ntfs_sync_sel, &set); pthread_mutex_lock(&ntfa_cb.cb_lock); ntfa_cb.ntfs_sync_awaited = 1; pthread_mutex_unlock(&ntfa_cb.cb_lock); @@ -51,7 +49,7 @@ static unsigned int ntfa_create(void) } /* Block and wait for indication from MDS meaning NTFS is up */ - m_NCS_SEL_OBJ_SELECT(ntfa_cb.ntfs_sync_sel, &set, 0, 0, &timeout); + osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(ntfa_cb.ntfs_sync_sel), 30000); pthread_mutex_lock(&ntfa_cb.cb_lock); ntfa_cb.ntfs_sync_awaited = 0; diff --git a/osaf/tools/safntf/ntfread/ntfread.c b/osaf/tools/safntf/ntfread/ntfread.c --- a/osaf/tools/safntf/ntfread/ntfread.c +++ b/osaf/tools/safntf/ntfread/ntfread.c @@ -27,7 +27,6 @@ #include <getopt.h> #include <sys/types.h> #include <sys/socket.h> -#include <sys/select.h> #include <sys/un.h> #include <time.h> #include <fcntl.h> diff --git a/osaf/tools/safntf/ntfsend/ntfsend.c b/osaf/tools/safntf/ntfsend/ntfsend.c --- a/osaf/tools/safntf/ntfsend/ntfsend.c +++ b/osaf/tools/safntf/ntfsend/ntfsend.c @@ -26,7 +26,6 @@ #include <getopt.h> #include <sys/types.h> #include <sys/socket.h> -#include <sys/select.h> #include <sys/un.h> #include <time.h> #include <fcntl.h> diff --git a/osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c b/osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c --- a/osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c +++ b/osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c @@ -28,7 +28,6 @@ #include <getopt.h> #include <sys/types.h> #include <sys/socket.h> -#include <sys/select.h> #include <sys/un.h> #include <time.h> #include <fcntl.h> diff --git a/tests/ntfsv/Makefile.am b/tests/ntfsv/Makefile.am --- a/tests/ntfsv/Makefile.am +++ b/tests/ntfsv/Makefile.am @@ -80,4 +80,5 @@ endif ntftest_LDADD = \ $(top_builddir)/osaf/libs/saf/libSaNtf/libSaNtf.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 ------------------------------------------------------------------------------ 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