Re: [devel] [PATCH 01 of 15] amf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

2013-11-26 Thread Hans Feldt
Ack
/Hans

On 10/31/2013 02:24 PM, Anders Widell wrote:
>   osaf/libs/agents/saf/amfa/ava_init.c |  8 +++-
>   1 files changed, 3 insertions(+), 5 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/amfa/ava_init.c 
> b/osaf/libs/agents/saf/amfa/ava_init.c
> --- a/osaf/libs/agents/saf/amfa/ava_init.c
> +++ b/osaf/libs/agents/saf/amfa/ava_init.c
> @@ -34,6 +34,7 @@
>   #include "ava.h"
>   #include 
>   #include "osaf_utility.h"
> +#include "osaf_poll.h"
>
>   /* global cb handle */
>   uint32_t gl_ava_hdl = 0;
> @@ -117,8 +118,7 @@ uint32_t ava_lib_req(NCS_LIB_REQ_INFO *r
>   uint32_t ava_create(NCS_LIB_CREATE *create_info)
>   {
>   AVA_CB *cb = 0;
> - NCS_SEL_OBJ_SET set;
> - uint32_t rc = NCSCC_RC_SUCCESS, timeout = 300;
> + uint32_t rc = NCSCC_RC_SUCCESS;
>   EDU_ERR err;
>   TRACE_ENTER();
>
> @@ -181,8 +181,6 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
>   }
>   TRACE("AVA Handles DB created successfully");
>
> - m_NCS_SEL_OBJ_ZERO(&set);
> - m_NCS_SEL_OBJ_SET(cb->sel_obj, &set);
>   m_AVA_FLAG_SET(cb, AVA_FLAG_FD_VALID);
>
>   /* register with MDS */
> @@ -195,7 +193,7 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
>
>   TRACE_1("Waiting on select till AMF Node Director is up");
>   /* block until mds detects avnd */
> - m_NCS_SEL_OBJ_SELECT(cb->sel_obj, &set, 0, 0, &timeout);
> + osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(cb->sel_obj), 3000);
>
>   /* reset the fd validity flag  */
>   m_NCS_LOCK(&cb->lock, NCS_LOCK_WRITE);
>
> --
> 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
>
>

--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 01 of 15] amf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

2013-10-31 Thread Anders Widell
 osaf/libs/agents/saf/amfa/ava_init.c |  8 +++-
 1 files changed, 3 insertions(+), 5 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/amfa/ava_init.c 
b/osaf/libs/agents/saf/amfa/ava_init.c
--- a/osaf/libs/agents/saf/amfa/ava_init.c
+++ b/osaf/libs/agents/saf/amfa/ava_init.c
@@ -34,6 +34,7 @@
 #include "ava.h"
 #include 
 #include "osaf_utility.h"
+#include "osaf_poll.h"
 
 /* global cb handle */
 uint32_t gl_ava_hdl = 0;
@@ -117,8 +118,7 @@ uint32_t ava_lib_req(NCS_LIB_REQ_INFO *r
 uint32_t ava_create(NCS_LIB_CREATE *create_info)
 {
AVA_CB *cb = 0;
-   NCS_SEL_OBJ_SET set;
-   uint32_t rc = NCSCC_RC_SUCCESS, timeout = 300;
+   uint32_t rc = NCSCC_RC_SUCCESS;
EDU_ERR err;
TRACE_ENTER();
 
@@ -181,8 +181,6 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
}
TRACE("AVA Handles DB created successfully");
 
-   m_NCS_SEL_OBJ_ZERO(&set);
-   m_NCS_SEL_OBJ_SET(cb->sel_obj, &set);
m_AVA_FLAG_SET(cb, AVA_FLAG_FD_VALID);
 
/* register with MDS */
@@ -195,7 +193,7 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
 
TRACE_1("Waiting on select till AMF Node Director is up");
/* block until mds detects avnd */
-   m_NCS_SEL_OBJ_SELECT(cb->sel_obj, &set, 0, 0, &timeout);
+   osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(cb->sel_obj), 3000);
 
/* reset the fd validity flag  */
m_NCS_LOCK(&cb->lock, NCS_LOCK_WRITE);

--
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