Subject: Re: m_copy - doesn't copy if M_EXT is set.
To: Darren Reed <darrenr@reed.wattle.id.au>
From: Justin C. Walker <justin@apple.com>
List: tech-net
Date: 10/03/1999 17:23:24
> From: Darren Reed <darrenr@reed.wattle.id.au>
> Date: 1999-10-03 06:38:03 -0700
> To: tech-net@netbsd.org
> Subject: m_copy - doesn't copy if M_EXT is set.
> Delivered-to: tech-net@netbsd.org
> X-Mailer: ELM [version 2.4ME+ PL37 (25)]
>
>
> It would appear that the behaviour of m_copy()/m_copym() is changed,
> depending on whether or not M_EXT is set. If M_EXT is set, then the
> buffer is *NOT* coppied, just another external reference is made and
> the appropriate counter incremented. If it is unset, then a new
> buffer is allocated (M_GET) and data copied from the orignal to the
> copy.
You're correct about the behavior of m_copy()/m_copym(), but not
about it's having changed. This is old behavior. I was a bit
surprised, initially, when trying to add support for the Mac OS
networking stack in what is now Mac OS X Server. The Open Transport
stack kept getting TCP packets with the checksums set to zero :-}.
I took the simple way out and implemented "m_dup()" [see the
Darwin source; the code is somewhere in ".../net", not in
".../kern/uipc_mbuf.c"]. This does a "real" copy.
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics |
Manager, CoreOS Networking | When crypto is outlawed,
Apple Computer, Inc. | Only outlaws will have crypto.
2 Infinite Loop |
Cupertino, CA 95014 |
*-------------------------------------*-------------------------------*