James Carlson wrote:
> Darren Reed writes:
>
>> A pair of convenience functions that I'd like to eventually
>> see make their way into OpenSolaris is to copy data from a
>> static buffer into an mblk and to copy data from an mblk
>> into a static buffer.
>>
>
> A lot depends on context: exactly what is that "static buffer" and why
> isn't the existing b_rptr sufficient? Depending on what you're trying
> to do, there may well be multiple possible answers.
>
> If it's just one mblk (and not a chain), then why doesn't bcopy()
> itself work?
>
> One possible answer would be to use the existing mcopymsg() function
> after determining that the message is reasonable for the buffer, and
> to use one of the *esballoc* functions to go from a buffer to an mblk
> without copying data.
>
One significant problem with mcopymsg() is that it freemsg()'s the
source mblk. This is an unexpected (and previously undocumented) side
effect. (I filed a man page bug, which was fixed, to get the side
effect documented.)
This is what happens when folks just blithely promote to public APIs
that are used internally without some basic review. I would probably
have complained loudly about the side effect at any ARC review, but the
promotion occurred before I had any ARC participation.
I wouldn't complain if something like mcopymsg() were created that
lacked the side effect, mcopydata() or somesuch.
-- Garrett
_______________________________________________
networking-discuss mailing list
[email protected]