From owner-p4-projects@FreeBSD.ORG Mon Dec 24 11:38:45 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 580D916A421; Mon, 24 Dec 2007 11:38:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7A3716A41B for ; Mon, 24 Dec 2007 11:38:44 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BA7AD13C45B for ; Mon, 24 Dec 2007 11:38:44 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBOBcieh084188 for ; Mon, 24 Dec 2007 11:38:44 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBOBcifm084185 for perforce@freebsd.org; Mon, 24 Dec 2007 11:38:44 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 24 Dec 2007 11:38:44 GMT Message-Id: <200712241138.lBOBcifm084185@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 131515 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2007 11:38:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=131515 Change 131515 by rwatson@rwatson_cinnamon on 2007/12/24 11:38:24 Update comments. Affected files ... .. //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#14 edit Differences ... ==== //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#14 (text+ko) ==== @@ -143,8 +143,11 @@ #ifdef BIOCGETBUFMODE /* - * Simple version of pcap_next_zbuf() -- do the shared memory part, but no - * blocking. + * Zero-copy BPF buffer routines to check for and acknowledge BPF data in + * shared memory buffers. + * + * pcap_next_zbuf_shm(): Check for a newly available shared memory buffer, + * and set up p->buffer and cc to reflect one if available. */ static int pcap_next_zbuf_shm(pcap_t *p, u_int *cc) @@ -178,12 +181,11 @@ } /* - * Selection routine for zero-copy BPF: identify the next completed buffer, - * if any. Try shared memory first, and if that doesn't work, make a system - * call, which may dislodge a buffer. - * - * Return (1) if the buffer is found, (0) if a retry is required, and (-1) if - * there is an unrecoverable error. + * pcap_next_zbuf() -- Similar to pcap_next_zbuf_shm(), except wait using + * select() for data or a timeout, and possibly force rotation of the buffer + * in the event we time out or are in immediate mode. Invoke the shared + * memory check before doing system calls in order to avoid doing avoidable + * work. */ static int pcap_next_zbuf(pcap_t *p, u_int *cc)