PERFORCE change 131515 for review

Robert Watson rwatson at FreeBSD.org
Mon Dec 24 03:38:45 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=131515

Change 131515 by rwatson at 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)


More information about the p4-projects mailing list