Rosen Rosen
|
Select on BPF file descriptor
|
Rosen Rosen
02/13/2009 9:00 AM
post22196
|
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.
|
|
|