mbuf allocate customisation

Steven Johnson sjohnson at sakuraindustries.com
Wed May 24 00:10:06 UTC 2006

Hi Eric, Joel and list,

Attached is my hopefully, final customisable mbuf allocator patch.  I've
tested it in my code, and it seems to work.  My latest fundamental
problem lay with autotools stuff and my meagre understanding. But I
think its resolved, and now should build OK with the existing behaviour
(dynamic allocation) if it isn't customised by the user.  The patch
contains my changes to "cpukit/libnetworking/Makefile.am" and the
changes to the autogenerated "cpukit/libnetworking/Makefile.in" so that
it can be built, after application of the patch (without requiring a
re-run of bootstrap).

To override mbuf allocation, a user #includes "rtems_bsdnet.h" and then
creates there own "malloc_mbuf" function, which is like malloc, but it
also passes a "type" of mbuf being allocated, so the code can be smart
about what it returns.  The types are constants:

#define MBUF_MALLOC_MBUF        (2)

are defined in "rtems_bsdnet.h" so a user implementation can reference them.

There is a new file "rtems_malloc_mbuf.c" which declares the default
dynamic allocator (calling malloc).  The changes to rtems_glue.c simply
consist of replacements from malloc calls to calls to "malloc_mbuf".

If this is integrated, ill put a page in the wiki, showing how to do
static allocation with it (from my code which does it).

Steven J

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtems-
Type: text/x-patch
Size: 10802 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20060524/75b8e249/attachment-0001.bin>

More information about the users mailing list