Mario Charest
|
RE: select() call is not working
|
Mario Charest
02/20/2009 5:43 PM
post22674
|
RE: select() call is not working
> -----Original Message-----
> From: rajesh k [mailto:community-noreply@qnx.com]
> Sent: February-20-09 5:41 PM
> To: technology-networking
> Subject: select() call is not working
>
> HI,
> any one can help on this.
> select() call is not working on file descriptors. it is not all
> blocking.
>
> #include<sys/select.h>
> #include <sys/syspage.h>
> #include <fcntl.h>
> #include"nipcinternonblk.h"
>
>
> int main(int argc, char *argv[]) {
>
> int sel_res, fd;
> fd_set rd_set;
>
> fd = open("/tmp/tst",O_RDWR );
>
>
> while(1)
> {
> printf("entered whl loop\n");
> FD_ZERO(&rd_set);
> FD_SET(fd,&rd_set);
> sel_res = select(FD_SETSIZE, &rd_set,NULL,NULL,NULL);
> printf("select val:%d\n",sel_res);-----------> always giving 1
> if(FD_ISSET(chid, &rd_set ))
> do something..............
>
> }
> }
>
I believe FD_SETSIZE should be equal to fd + 1. That being said under QNX6 it don't think it makes any sense to do a
select on a file description that is pointing to a file.
> _______________________________________________
> Technology
> http://community.qnx.com/sf/go/post22673
>
|
|
|
Sean Boudreau(deleted)
|
Re: select() call is not working
|
Sean Boudreau(deleted)
02/21/2009 9:25 PM
post22686
|
Re: select() call is not working
On Fri, Feb 20, 2009 at 05:40:39PM -0500, rajesh k wrote:
> HI,
> any one can help on this.
> select() call is not working on file descriptors. it is not all blocking.
>
> #include<sys/select.h>
> #include <sys/syspage.h>
> #include <fcntl.h>
> #include"nipcinternonblk.h"
>
>
> int main(int argc, char *argv[]) {
>
> int sel_res, fd;
> fd_set rd_set;
>
> fd = open("/tmp/tst",O_RDWR );
>
>
> while(1)
> {
> printf("entered whl loop\n");
> FD_ZERO(&rd_set);
> FD_SET(fd,&rd_set);
> sel_res = select(FD_SETSIZE, &rd_set,NULL,NULL,NULL);
> printf("select val:%d\n",sel_res);-----------> always giving 1
> if(FD_ISSET(chid, &rd_set ))
> do something..............
>
> }
> }
Returning from select() for read means you won't block on read which
I suspect you won't in this example.
Regards,
-seanb
|
|
|