Sean Boudreau(deleted)
|
Re: Select on BPF file descriptor
|
Sean Boudreau(deleted)
02/13/2009 9:52 AM
post22217
|
Re: Select on BPF file descriptor
On Fri, Feb 13, 2009 at 09:00:19AM -0500, Rosen Rosen wrote:
> 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.
>
Hmm, is the select failing (-1 with ENOSYS)? If so
it's probably a bug. Can you conjure up a complete
test case?
-seanb
|
|
|