| Summary: | The example in netmap.4 is wrong | ||
|---|---|---|---|
| Product: | Documentation | Reporter: | mirnshi <mirnshi> |
| Component: | Books & Articles | Assignee: | freebsd-doc (Nobody) <doc> |
| Status: | Closed Overcome By Events | ||
| Severity: | Affects Only Me | CC: | bcr |
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
The netmap man page was updated and the examples were also changed. I'll close this PR, but thanks for submitting it. |
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); } } Fix: delete this example from the man page or copy from http://info.iet.unipi.it/~luigi/netmap/. How-To-Repeat: man netmap