On Sat, Apr 16, 2011 at 03:49, YunQiang Su <wzss...@gmail.com> wrote: > I got it. > > It used it like this > > #if !defined(__linux__)&&!defined(__APPLE__) > { > int immed = 1; > if (ioctl(pfd_, BIOCIMMEDIATE, &immed) < 0) { > fprintf(stderr, > "warning: pcap/live (%s) couldn't set immed\n", > name()); > perror("ioctl(BIOCIMMEDIATE)"); > } > } > #endif > > On linux , BIOCIMMEDIATE is not used, but on BSD, it did being used, > but did *not* include net/bpf.h > > Then there are 2 ways to fix this bug: > 1. also disable the above code block on BSD. > 2. include net/bpf.h on BSD platform. > > Which one is better ? > -- > YunQiang Su >
I prefer to attempting to use this piece of code first. Because using BIOCIMMEDIATE could very probably get some advantages over not using them on kbsd platforms. Here is a thread about it in freebsd-arch mailing list: http://lists.freebsd.org/pipermail/freebsd-arch/2003-November/001446.html > No. BIOCIMMEDIATE and non-blocking mode are different. > > BIOCIMMEDIATE mode means "make incoming packets > readable immediately; don't buffer them up until either the > store buffer is full or the timeout expires". This is for use in, > for example, applications that are using BPF to implement > network protocols, and want to be able to respond > immediately to incoming packets, as opposed to, for > example, packet capture applications (tcpdump, Ethereal, > etc.) which don't necessarily need to immediately show or > save incoming packets and which might want to try to get > as many packets as possible per read on the BPF device. -- Regards, Aron Xu -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/BANLkTimCNQ=9yfdrv25ajuez5k5rnfa...@mail.gmail.com