Date: Mon, 4 Mar 2013 18:34:50 GMT From: Paul Meng <mirnshi@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: docs/176645: The example in man page netmap is wrong Message-ID: <201303041834.r24IYoW1055129@red.freebsd.org> Resent-Message-ID: <201303041840.r24Ie1kU017202@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 176645 >Category: docs >Synopsis: The example in man page netmap is wrong >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 04 18:40:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Paul Meng >Release: 9.1 >Organization: >Environment: FreeBSD bsd9 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The example in man page netmap is wrong. Struct netmap_request can not be found, 'buf_index' is not a member of struct netmap_ring, etc. #include <net/netmap.h> #include <net/netmap_user.h> struct netmap_if *nifp; struct netmap_ring *ring; struct netmap_request nmr; fd = open("/dev/netmap", O_RDWR); bzero(&nmr, sizeof(nmr)); strcpy(nmr.nm_name, "ix0"); ioctl(fd, NIOCREG, &nmr); p = mmap(0, nmr.memsize, fd); nifp = NETMAP_IF(p, nmr.offset); ring = NETMAP_TXRING(nifp, 0); fds.fd = fd; fds.events = POLLOUT; for (;;) { poll(list, 1, -1); while (ring->avail-- > 0) { i = ring->cur; buf = NETMAP_BUF(ring, ring->slot[i].buf_index); ... prepare packet in buf ... ring->slot[i].len = ... packet length ... ring->cur = NETMAP_RING_NEXT(ring, i); } } >How-To-Repeat: man netmap >Fix: delete this example from the man page or copy from http://info.iet.unipi.it/~luigi/netmap/. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303041834.r24IYoW1055129>