[haiku-development] mbufs in freebsd compat

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 16 Mar 2008 19:36:41 +0100 CET

Having run into
http://dev.haiku-os.org/attachment/ticket/1641/rtl8139-new-bug.txt
I had a look around in the FreeBSD compatibility layer.

1) In src/libs/compat/freebsd_network/device.c
        in compat_read(), this line
   memcpy(buffer, mtod(mb, const void *), length);

appears to copy the data of a single mbuf
and then the mbuf chain is freed
   m_freem(mb);

Is it safe to assume there is only one mbuf and not a chain of
mbufs? (freeing unread data?) Perhaps I'm missing something.

2) 
http://www.freebsd.org/cgi/man.cgi?query=mtod&apropos=0&sektion=0&manpath=FreeBSD+6.3-RELEASE&format=html
"Programmers should be careful not to confuse the mbuf allocation flag 
M_DONTWAIT with the malloc(9) allocation flag, M_NOWAIT.  They are not 
the same."

src/libs/compat/freebsd_network/compat/sys/mbuf.h
#define M_DONTWAIT    M_NOWAIT

3) In src/libs/compat/freebsd_network
why the division mbuf.c and fbsd_mbuf.c? 

The comment at the top of mbuf.c mentions m_defrag 
which lives in fbsd_mbuf.c now.

/Jonas.


Other related posts: