Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Select on BPF file descriptor : Page 1 of 8 (8 Items)
   
Select on BPF file descriptor  
hi,

I am working on a BPF device which has a filter set for detecting packets with the tag: 0x9999. 
The code has a select call before reading from the file descriptor: code snippet below
If ((select_return = select( (1+fd), &fdset, NULL , NULL , NULL) ))
  {
              printf("\n select return %d \n", select_return);
        if( (FD_ISSET(fd, &fdset) ))
        {
          printf("\n reading from bfp -- device socket is set \n");
          if ((BytesRead = read(fd, buf, PktLen)) < 0)
          {
                  perror("read");
                  exit(EXIT_FAILURE);
          }
but even when  there is data available on the socket  the select always returns
Hence the program gets blocked on the read (which in turn calls MsgSend () internally) as they is no data available when
 you try to read. 

Pidin –p displays the following 

     pid tid name               prio STATE       Blocked
  561191   1 ./a.out             10r REPLY       114706

Does the select call does not support bpf fd’s  or am  I going wrong at some point.