Greetings, The past couple of days I've been plagued by a strange behaviour of something between libpcap and the bpf-device. As you can read in PR bin/31649, the behaviour of libpcap is very different if you compile it on gcc with or without -pthread:
Without -pthread, it calls the callback function everytime it has received a packet. With -pthread, it calls the callback function only when the input-buffer (about 32Kb) is nearly full. I've done some investigation (with my limited knowledge of what happens between a call to read() and when it ends up in bpfread()) and saw the difference between a call with and without the -pthreads option: in /usr/src/contrib/libpcap/pcap-bpf.c, line 81, the function pcap_read(): cc = read(p->fd, (char *)p->buffer, p->bufsize); at a certain moment, in the read()-code, bpfread() is called: /sys/net/bpf.c, line 491 In a non-threaded environment, this if-statement is false if (ioflag & IO_NDELAY) { splx(s); return (EWOULDBLOCK); } In a threaded environment, the if-statement is true, splx(s) is called and EWOULDBLOCK is returned. Then it's silent for a while, while the packets are being collected (somewhere) and at a certain moment the buffer is nearly full and the read() in pcap_read() is finished. So yeah, I'm stuck. All I want is in threaded mode to have the same behaviour as I have in non-threaded mode. Anybody any ideas on how to fix this? Thanks in advance, Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org [EMAIL PROTECTED] | Interested in MUDs? Visit Fatal Dimensions: ------------------+ http://www.FatalDimensions.org/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message