Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-libs/libpcap/files: libpcap-1.0.1_pre20090812-poll-cpu-usage.patch
Date: Sat, 29 Aug 2009 15:57:49
Message-Id: E1MhV8M-0006Pc-UL@stork.gentoo.org
1 robbat2 09/08/29 21:06:50
2
3 Added: libpcap-1.0.1_pre20090812-poll-cpu-usage.patch
4 Log:
5 Bump to newer snapshot, and include poll() CPU usage fix from Ubuntu. Massively drops CPU usage for live captures again.
6 (Portage version: 2.2_rc40/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 net-libs/libpcap/files/libpcap-1.0.1_pre20090812-poll-cpu-usage.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libpcap/files/libpcap-1.0.1_pre20090812-poll-cpu-usage.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libpcap/files/libpcap-1.0.1_pre20090812-poll-cpu-usage.patch?rev=1.1&content-type=text/plain
13
14 Index: libpcap-1.0.1_pre20090812-poll-cpu-usage.patch
15 ===================================================================
16 https://bugs.launchpad.net/ubuntu/+source/tcpdump/+bug/369288
17
18 Rediffed to apply.
19
20 diff -Nuar --exclude '*.orig' --exclude '*.rej' libpcap-1.0.1-20090708.orig/pcap-linux.c libpcap-1.0.1-20090708/pcap-linux.c
21 --- libpcap-1.0.1-20090708.orig/pcap-linux.c 2009-07-08 11:52:08.000000000 +0000
22 +++ libpcap-1.0.1-20090708/pcap-linux.c 2009-08-29 20:47:44.951806355 +0000
23 @@ -2785,6 +2785,19 @@
24 handle->fd, errno, pcap_strerror(errno));
25 return -1;
26 }
27 +
28 + /* poll() sometimes returns > 0 even in error cases
29 + * and sets error-bits like POLLERR, POLLHUP, ..
30 + * Are also "good" bits are possible, like POLLPRI.
31 + * TODO: what's with POLLRDHUP since kernel 2.6.17?
32 + */
33 + if (ret > 0 && pollinfo.revents & (POLLERR | POLLHUP | POLLNVAL)) {
34 + snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
35 + "critical revent in poll on packet socket fd %d: 0x%4.4x",
36 + handle->fd, pollinfo.revents);
37 + return -1;
38 + }
39 +
40 /* check for break loop condition on interrupted syscall*/
41 if (handle->break_loop) {
42 handle->break_loop = 0;