osaf/libs/agents/infrastructure/rda/rda_papi.c |  36 +++++--------------------
 1 files changed, 7 insertions(+), 29 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/infrastructure/rda/rda_papi.c 
b/osaf/libs/agents/infrastructure/rda/rda_papi.c
--- a/osaf/libs/agents/infrastructure/rda/rda_papi.c
+++ b/osaf/libs/agents/infrastructure/rda/rda_papi.c
@@ -32,9 +32,10 @@
 /*
 ** Includes
 */
-#include <rda.h>
-
+#include "rda.h"
 #include <sched.h>
+#include "logtrace.h"
+#include "osaf_poll.h"
 
 /*
 ** Global data
@@ -654,35 +655,12 @@ static uint32_t rda_write_msg(int sockfd
 *****************************************************************************/
 static uint32_t rda_read_msg(int sockfd, char *msg, int size)
 {
-       int rc = PCSRDA_RC_SUCCESS;
+       int rc;
        int msg_size = 0;
-       int retry_cnt = 0;
-       fd_set readfds;
-       struct timeval tv;
 
- RDE_SELECT:
-       FD_ZERO(&readfds);
-
-       /* 
-        * Set timeout value
-        */
-       tv.tv_sec = 30;
-       tv.tv_usec = 0;
-
-       /*
-        * Set RDA interface socket fd
-        */
-       FD_SET(sockfd, &readfds);
-
-       rc = select(sockfd + 1, &readfds, NULL, NULL, &tv);
+       rc = osaf_poll_one_fd(sockfd, 30000);
        if (rc < 0) {
-               if (errno == 4) {       /* EINTR */
-                       printf("select: PCSRDA_RC_IPC_RECV_FAILED: rc=%d-%s\n", 
errno, strerror(errno));
-                       if (retry_cnt < 5) {
-                               retry_cnt++;
-                               goto RDE_SELECT;
-                       }
-               }
+               LOG_ER("poll: PCSRDA_RC_IPC_RECV_FAILED: rc=%d-%s\n", errno, 
strerror(errno));
                return PCSRDA_RC_IPC_RECV_FAILED;
        }
 
@@ -698,7 +676,7 @@ static uint32_t rda_read_msg(int sockfd,
         */
        msg_size = recv(sockfd, msg, size, 0);
        if (msg_size < 0) {
-               printf("recv: PCSRDA_RC_IPC_RECV_FAILED: rc=%d-%s\n", errno, 
strerror(errno));
+               LOG_ER("recv: PCSRDA_RC_IPC_RECV_FAILED: rc=%d-%s\n", errno, 
strerror(errno));
                return PCSRDA_RC_IPC_RECV_FAILED;
        }
 

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

Reply via email to