Browse Source

Remove currently unused lubheap library

git-svn-id: https://klish.googlecode.com/svn/trunk@423 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
6d398ca00d

+ 0 - 4
Makefile.am

@@ -21,7 +21,6 @@ EXTRA_DIST              =  \
     bin/module.am          \
     clish/module.am        \
     lub/module.am          \
-    lubheap/module.am      \
     tinyrl/module.am       \
     tinyxml/module.am      \
     test/module.am         \
@@ -34,12 +33,9 @@ EXTRA_DIST              =  \
     CHANGES                \
     ISSUES
 
-
-
 include $(top_srcdir)/bin/module.am
 include $(top_srcdir)/clish/module.am
 include $(top_srcdir)/lub/module.am
-include $(top_srcdir)/lubheap/module.am
 include $(top_srcdir)/tinyrl/module.am
 include $(top_srcdir)/tinyxml/module.am
 include $(top_srcdir)/test/module.am

File diff suppressed because it is too large
+ 27 - 42
Makefile.in


+ 0 - 253
lubheap/README

@@ -1,253 +0,0 @@
-/**
-\defgroup lubheap "Little Useful Bits Heap" Library
-@{
-\section Overview
-This library can be linked with executables to override the standard memory
-management provided by the system libraries. This may provide a 
-performance and debugging advantage.
-
-The implementation uses the \ref lub_heap component to control system memory
-and hence provides all the features available within that memory manager. 
-(including leak detection)
-
-\section VxWorks
-Replaces the memPartLib.o, memLib.o and memShow.o found in the
-libos.a library archive.
-
-\subsection memlib memLib.o functions
-<code>
-calloc, cfree, memFindMax, memInit, memLibInit, memOptionsSet, 
-memPartFindMax, memPartOptionsSet, memPartRealloc, memalign, realloc, valloc
-</code>
-
-\subsection mempartlib memPartLib.o functions
-<code>
-free, malloc, memAddToPool, memPartAddToPool, memPartAlignedAlloc, 
-memPartAlloc, memPartBlockIsValid, memPartCreate, memPartFree, 
-memPartInit, memPartLibInit
-</code>
-
-\subsection memshow memShow.o functions
-<code>
-memShow, memPartInfoGet, memParShow
-</code>
-
-\section posix POSIX
-Replaces the dynamic memory functionality found in the libc.a 
-library archive.
-
-This implementation relies on the sbrk() function to provide memory
-chunks to feed the standard heap.
-
-\subsection Functions
-<code>
-calloc, cfree, free, malloc, memalign, realloc, valloc
-</code>
-
-
-\section Performance
-Running the unittests with this library provides the following comparisons on
-some test machines:
-
-\section x86_64-unknown-linux-gnu
-<TABLE>
-<TR>
-  <TD><B>Native memory management</B> (<code>./test/mallocTest</code>)</TD>
-  <TD><B>lubheap memory management</B> (<code>./test/lubMallocTest</code>)</TD>
-</TR>
-<TR>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          0 milliseconds
-***    400 in          0 milliseconds
-***    500 in          1 milliseconds
-***   1000 in          3 milliseconds
-***   2000 in          7 milliseconds
-***   3000 in         12 milliseconds
-***   4000 in         16 milliseconds
-***   5000 in         21 milliseconds
-***  10000 in         48 milliseconds
-***  15000 in         79 milliseconds
-***  20000 in        143 milliseconds
-***  25000 in        200 milliseconds
-***  30000 in        253 milliseconds
-***  35000 in        314 milliseconds
-***  40000 in        378 milliseconds
-***  45000 in        460 milliseconds
-***  50000 in        561 milliseconds
-***  60000 in        790 milliseconds
-***  70000 in       1036 milliseconds
-***  80000 in       1320 milliseconds
-***  90000 in       1653 milliseconds
-*** 100000 in       2037 milliseconds
-</PRE>
-</TD>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          0 milliseconds
-***    400 in          1 milliseconds
-***    500 in          1 milliseconds
-***   1000 in          3 milliseconds
-***   2000 in          6 milliseconds
-***   3000 in          9 milliseconds
-***   4000 in         11 milliseconds
-***   5000 in         13 milliseconds
-***  10000 in         37 milliseconds
-***  15000 in         49 milliseconds
-***  20000 in         61 milliseconds
-***  25000 in         75 milliseconds
-***  30000 in         89 milliseconds
-***  35000 in         99 milliseconds
-***  40000 in        113 milliseconds
-***  45000 in        125 milliseconds
-***  50000 in        138 milliseconds
-***  60000 in        177 milliseconds
-***  70000 in        203 milliseconds
-***  80000 in        228 milliseconds
-***  90000 in        254 milliseconds
-*** 100000 in        277 milliseconds
-</PRE>
-</TD>
-</TR>
-</TABLE>
-
-\section i686-pc-linux-gnu
-<TABLE>
-<TR>
-  <TD><B>Native memory management</B> (<code>./test/mallocTest</code>)</TD>
-  <TD><B>lubheap memory management</B> (<code>./test/lubMallocTest</code>)</TD>
-</TR>
-<TR>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          0 milliseconds
-***    400 in          1 milliseconds
-***    500 in          1 milliseconds
-***   1000 in          3 milliseconds
-***   2000 in          7 milliseconds
-***   3000 in         12 milliseconds
-***   4000 in         16 milliseconds
-***   5000 in         21 milliseconds
-***  10000 in         46 milliseconds
-***  15000 in         76 milliseconds
-***  20000 in        111 milliseconds
-***  25000 in        151 milliseconds
-***  30000 in        199 milliseconds
-***  35000 in        256 milliseconds
-***  40000 in        318 milliseconds
-***  45000 in        393 milliseconds
-***  50000 in        472 milliseconds
-***  60000 in        658 milliseconds
-***  70000 in        874 milliseconds
-***  80000 in       1121 milliseconds
-***  90000 in       1411 milliseconds
-*** 100000 in       1745 milliseconds
-</PRE>
-</TD>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          1 milliseconds
-***    400 in          1 milliseconds
-***    500 in          1 milliseconds
-***   1000 in          4 milliseconds
-***   2000 in          7 milliseconds
-***   3000 in         11 milliseconds
-***   4000 in         13 milliseconds
-***   5000 in         15 milliseconds
-***  10000 in         42 milliseconds
-***  15000 in         57 milliseconds
-***  20000 in         72 milliseconds
-***  25000 in         89 milliseconds
-***  30000 in        105 milliseconds
-***  35000 in        121 milliseconds
-***  40000 in        136 milliseconds
-***  45000 in        154 milliseconds
-***  50000 in        169 milliseconds
-***  60000 in        213 milliseconds
-***  70000 in        246 milliseconds
-***  80000 in        278 milliseconds
-***  90000 in        311 milliseconds
-*** 100000 in        341 milliseconds
-</PRE>
-</TD>
-</TR>
-</TABLE>
-
-\section i686-pc-cygwin
-For some reason the native memory management under cygwin is quicker. My suspcion is that there is an overhead in the
-<CODE>sbrk()</CODE> call via the cygwin sub-system which slows the lubheap implementation...
-<TABLE>
-<TR>
-  <TD><B>Native memory management</B> (<code>./test/mallocTest</code>)</TD>
-  <TD><B>lubheap memory management</B> (<code>./test/lubMallocTest</code>)</TD>
-</TR>
-<TR>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          0 milliseconds
-***    400 in          0 milliseconds
-***    500 in          0 milliseconds
-***   1000 in          0 milliseconds
-***   2000 in          0 milliseconds
-***   3000 in         16 milliseconds
-***   4000 in         15 milliseconds
-***   5000 in         16 milliseconds
-***  10000 in         31 milliseconds
-***  15000 in         47 milliseconds
-***  20000 in         63 milliseconds
-***  25000 in         93 milliseconds
-***  30000 in        125 milliseconds
-***  35000 in        204 milliseconds
-***  40000 in        203 milliseconds
-***  45000 in        218 milliseconds
-***  50000 in        266 milliseconds
-***  60000 in        328 milliseconds
-***  70000 in        360 milliseconds
-***  80000 in        406 milliseconds
-***  90000 in        500 milliseconds
-*** 100000 in        515 milliseconds
-</PRE>
-</TD>
-<TD>
-<PRE>
-***    100 in          0 milliseconds
-***    200 in          0 milliseconds
-***    300 in          0 milliseconds
-***    400 in          0 milliseconds
-***    500 in         15 milliseconds
-***   1000 in          0 milliseconds
-***   2000 in         16 milliseconds
-***   3000 in         31 milliseconds
-***   4000 in         31 milliseconds
-***   5000 in         47 milliseconds
-***  10000 in         94 milliseconds
-***  15000 in        156 milliseconds
-***  20000 in        188 milliseconds
-***  25000 in        250 milliseconds
-***  30000 in        281 milliseconds
-***  35000 in        375 milliseconds
-***  40000 in        375 milliseconds
-***  45000 in        453 milliseconds
-***  50000 in        484 milliseconds
-***  60000 in        625 milliseconds
-***  70000 in        672 milliseconds
-***  80000 in        813 milliseconds
-***  90000 in        875 milliseconds
-*** 100000 in        984 milliseconds
-</PRE>
-</TD>
-</TR>
-</TABLE>
-
-@}
-*/

+ 0 - 13
lubheap/module.am

@@ -1,13 +0,0 @@
-## Process this file with automake to generate Makefile.in
-if LUBHEAP
-  lib_LTLIBRARIES             += liblubheap.la
-  liblubheap_la_SOURCES        =
-endif
-
-EXTRA_DIST                  += \
-    lubheap/posix/module.am    \
-    lubheap/vxworks/module.am  \
-    lubheap/README
-
-include $(top_srcdir)/lubheap/posix/module.am
-include $(top_srcdir)/lubheap/vxworks/module.am

+ 0 - 3
lubheap/posix/module.am

@@ -1,3 +0,0 @@
-if LUBHEAP
-  liblubheap_la_SOURCES += lubheap/posix/sysheap.c
-endif

+ 0 - 262
lubheap/posix/sysheap.c

@@ -1,262 +0,0 @@
-/*
- * sysheap.c
- *
- * This is a replacement of the POSIX memory management system
- * 
- * It uses sbrk() to obtain memory chunks for use by the lub_heap 
- * component
- * 
- * We undefine the public functions
- * (just in case they've been MACRO overriden
- */
-#undef calloc
-#undef cfree
-#undef free
-#undef malloc
-#undef memalign
-#undef realloc
-#undef valloc
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <pthread.h>
-#include <string.h>
-#define __USE_XOPEN_EXTENDED /* needed for sbrk() */
-#include <unistd.h>
-
-#include "lub/partition/posix/private.h"
-
-#define VX_PAGE_SIZE 4096
-
-/* partition used for the system heap */
-static lub_posix_partition_t sysMemPartition;
-static lub_partition_t      *sys_partition = &sysMemPartition.m_base;
-static lub_heap_show_e       show_mode   = LUB_HEAP_SHOW_LEAKS;
-static const char           *leak_filter = 0;
-
-/* the partition is extended in 128K chunks as needed */
-#define DEFAULT_CHUNK_SIZE (128 * 1024)
-
-/*-------------------------------------------------------- */
-static void *
-sysheap_segment_alloc(size_t required)
-{
-    return sbrk(required);
-}
-/*-------------------------------------------------------- */
-void
-sysheap_atexit(void)
-{
-    /* dump the memory leak status */
-    lub_heap_leak_report(show_mode,leak_filter);
-}
-/*-------------------------------------------------------- */
-static void
-sysheap_init_memory(size_t required)
-{
-    static bool_t initialised;
-    if(BOOL_FALSE == initialised)
-    {
-        lub_partition_spec_t spec = 
-        {
-            BOOL_TRUE,            /* use_local_heap       */
-            8192,                 /* max_local_block_size */
-            8,                    /* num_local_max_blocks */
-            1 * 1024 * 1024,      /* min_segment_size     */
-            0,                    /* memory_limit         */
-            sysheap_segment_alloc /* sysalloc             */
-        };  
-        initialised = BOOL_TRUE;
-        lub_posix_partition_init(&sysMemPartition,&spec);
-
-/*        lub_heap_init("");
- */
-       atexit(sysheap_atexit);
-    }
-}
-/*-------------------------------------------------------- */
-static void
-sysheap_check_status(lub_heap_status_t status,
-                     const char       *where,
-                     void             *block,
-                     size_t            size)
-{
-    if(LUB_HEAP_OK != status)
-    {
-        switch(status)
-        {
-            /*------------------------------------------------- */
-            case LUB_HEAP_CORRUPTED:
-            {
-                fprintf(stderr,"%s: Heap corrupted\n",where);
-                break;
-            }
-            /*------------------------------------------------- */
-            case LUB_HEAP_DOUBLE_FREE:
-            {
-                fprintf(stderr,"%s: Double free of 0x%p\n",where,block);
-                break;
-            }
-            /*------------------------------------------------- */
-            case LUB_HEAP_INVALID_POINTER:
-            {
-                fprintf(stderr,"%s: Invalid Pointer 0x%p\n",where,block);
-                break;
-            }
-            /*------------------------------------------------- */
-            case LUB_HEAP_FAILED:
-            {
-                fprintf(stderr,"%s: allocation of %lu bytes failed\n",
-                        where,size);
-                break;
-            }
-            /*------------------------------------------------- */
-            case LUB_HEAP_OK:
-            {
-                break;
-            }
-            /*------------------------------------------------- */
-        }
-    }
-}
-/*-------------------------------------------------------- */
-void *
-calloc(size_t nmemb,
-       size_t size)
-{
-    char *ptr = malloc(nmemb*size);
-    if(NULL != ptr)
-    {
-        memset(ptr,0,size);
-    }
-    return ptr;
-}
-/*-------------------------------------------------------- */
-void
-cfree(void *ptr)
-{
-    free(ptr);
-}
-/*-------------------------------------------------------- */
-void
-free(void *ptr)
-{
-    char             *pBlock = ptr;
-    lub_heap_status_t status;
-
-    sysheap_init_memory(0);
-
-    status = lub_partition_realloc(sys_partition,
-                                   &pBlock,
-                                   0,
-                                   LUB_HEAP_ALIGN_NATIVE);
-
-    sysheap_check_status(status,"free",pBlock,0);
-}
-/*-------------------------------------------------------- */
-void *
-malloc(size_t nBytes)
-{
-    char             *pBlock = NULL;
-    lub_heap_status_t status;
-    
-    sysheap_init_memory(nBytes);
-
-    status = lub_partition_realloc(sys_partition,
-                                   &pBlock,
-                                   nBytes,
-                                   LUB_HEAP_ALIGN_NATIVE);
-
-    sysheap_check_status(status,"malloc",NULL,nBytes);
-
-    return pBlock;
-}
-/*-------------------------------------------------------- */
-void *
-memalign(unsigned alignment, 
-         unsigned nBytes)
-{
-    char             *pBlock = NULL;
-    lub_heap_status_t status = LUB_HEAP_OK;
-    lub_heap_align_t  align;
-
-    switch(alignment)
-    {
-        case 4:         align  = LUB_HEAP_ALIGN_2_POWER_2;  break;
-        case 8:         align  = LUB_HEAP_ALIGN_2_POWER_3;  break;
-        case 16:        align  = LUB_HEAP_ALIGN_2_POWER_4;  break;
-        case 32:        align  = LUB_HEAP_ALIGN_2_POWER_5;  break;
-        case 64:        align  = LUB_HEAP_ALIGN_2_POWER_6;  break;
-        case 128:       align  = LUB_HEAP_ALIGN_2_POWER_7;  break;
-        case 256:       align  = LUB_HEAP_ALIGN_2_POWER_8;  break;
-        case 512:       align  = LUB_HEAP_ALIGN_2_POWER_9;  break;
-        case 1024:      align  = LUB_HEAP_ALIGN_2_POWER_10; break;
-        case 2048:      align  = LUB_HEAP_ALIGN_2_POWER_11; break;
-        case 4096:      align  = LUB_HEAP_ALIGN_2_POWER_12; break;
-        case 8192:      align  = LUB_HEAP_ALIGN_2_POWER_13; break;
-        case 16384:     align  = LUB_HEAP_ALIGN_2_POWER_14; break;
-        case 32768:     align  = LUB_HEAP_ALIGN_2_POWER_15; break;
-        case 65536:     align  = LUB_HEAP_ALIGN_2_POWER_16; break;
-        case 131072:    align  = LUB_HEAP_ALIGN_2_POWER_17; break;
-        case 262144:    align  = LUB_HEAP_ALIGN_2_POWER_18; break;
-        case 524288:    align  = LUB_HEAP_ALIGN_2_POWER_19; break;
-        case 1048576:   align  = LUB_HEAP_ALIGN_2_POWER_20; break;
-        case 2097152:   align  = LUB_HEAP_ALIGN_2_POWER_21; break;
-        case 4194304:   align  = LUB_HEAP_ALIGN_2_POWER_22; break;
-        case 8388608:   align  = LUB_HEAP_ALIGN_2_POWER_23; break;
-        case 16777216:  align  = LUB_HEAP_ALIGN_2_POWER_24; break;
-        case 33554432:  align  = LUB_HEAP_ALIGN_2_POWER_25; break;
-        case 67108864:  align  = LUB_HEAP_ALIGN_2_POWER_26; break;
-        case 134217728: align  = LUB_HEAP_ALIGN_2_POWER_27; break;
-        default:        status = LUB_HEAP_FAILED;           break;
-    }
-    if(LUB_HEAP_OK == status)
-    {
-        status = lub_partition_realloc(sys_partition,
-                                       &pBlock,
-                                       nBytes,
-                                       align);
-    }
-    sysheap_check_status(status,"memalign",pBlock,nBytes);
-
-    return (LUB_HEAP_OK == status) ? pBlock : NULL;
-}
-/*-------------------------------------------------------- */
-void *
-realloc(void   *old_ptr, 
-        size_t  nBytes)
-{
-    char             *pBlock = old_ptr;
-    lub_heap_status_t status;
-
-    sysheap_init_memory(nBytes);
-
-    status = lub_partition_realloc(sys_partition,
-                                   &pBlock,
-                                   nBytes,
-                                   LUB_HEAP_ALIGN_NATIVE);
-
-    sysheap_check_status(status,"realloc",pBlock,nBytes);
-
-    return (LUB_HEAP_OK == status) ? pBlock : NULL;
-}
-/*-------------------------------------------------------- */
-void *
-valloc(unsigned size)
-{
-    return memalign(VX_PAGE_SIZE,size);
-}
-/*-------------------------------------------------------- */
-void
-sysheap_suppress_leak_detection(void)
-{
-    lub_partition_disable_leak_detection(sys_partition);
-}
-/*-------------------------------------------------------- */
-void
-sysheap_restore_leak_detection(void)
-{
-    lub_partition_enable_leak_detection(sys_partition);
-}
-/*-------------------------------------------------------- */

+ 0 - 140
lubheap/vxworks/memLib.c

@@ -1,140 +0,0 @@
-/*
- * memLib.c
- *
- * We undefine the public functions
- * (just in case they've been MACRO overriden
- */
-#undef calloc
-#undef cfree
-#undef memFindMax
-#undef memInit
-#undef memLibInit
-#undef memOptionsSet
-#undef memPartFindMax
-#undef memPartOptionsSet
-#undef memPartRealloc
-#undef memalign
-#undef realloc
-#undef valloc
-
-#include <string.h>
-
-#include <stdlib.h>
-#include <memPartLib.h>
-#include <memLib.h>
-#include <private/funcBindP.h>
-
-#include "private.h"
-
-#define VX_PAGE_SIZE 4096
-
-/*-------------------------------------------------------- */
-void *
-calloc(size_t elemNum,
-       size_t elemSize)
-{
-    size_t nBytes = elemNum * elemSize;
-    char  *ptr    = malloc(nBytes);
-
-    memset(ptr,0,nBytes);
-    
-    return ptr;
-}
-/*-------------------------------------------------------- */
-STATUS
-cfree(char *pBlock)
-{
-    return memPartFree(memSysPartId,pBlock);
-}
-/*-------------------------------------------------------- */
-int
-memFindMax(void)
-{
-    return memPartFindMax(memSysPartId);
-}
-/*-------------------------------------------------------- */
-STATUS
-memLibInit(char    *pPool, 
-           unsigned poolSize)
-{
-    memPartLibInit(pPool,poolSize);
-    return OK;
-}
-/*-------------------------------------------------------- */
-STATUS
-memInit(char    *pPool, 
-        unsigned poolSize)
-{
-    /* set up the system pointers */
-    _func_valloc   = (FUNCPTR) valloc;
-    _func_memalign = (FUNCPTR) memalign;
-
-    return memLibInit(pPool,poolSize);
-}
-/*-------------------------------------------------------- */
-void
-memOptionsSet (unsigned options)
-{
-    memPartOptionsSet(memSysPartId,options);
-}
-/*-------------------------------------------------------- */
-int 
-memPartFindMax(PART_ID partId)
-{
-    partition_t *this = (partition_t *)partId;
-    size_t     result;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    result = lub_heap__get_max_free(this->heap);
-    semGive(&this->sem);
-    
-    return result;
-}
-/*-------------------------------------------------------- */
-STATUS
-memPartOptionsSet(PART_ID  partId, 
-                  unsigned options)
-{
-    partition_t  *this = (partition_t*)partId;
-    
-    this->options = options;
- 
-    return OK;
-}
-/*-------------------------------------------------------- */
-void *   
-memPartRealloc(PART_ID partId, 
-               char   *pBlock, 
-               unsigned nBytes)
-{
-    partition_t        *this = (partition_t *)partId;
-    lub_heap_status_t status;
-
-    semTake(&this->sem,WAIT_FOREVER);
-    status = lub_heap_realloc(this->heap,&pBlock,nBytes,LUB_HEAP_ALIGN_NATIVE);
-    semGive(&this->sem);
-
-    lubheap_vxworks_check_status(this,status,"memPartRealloc",pBlock,nBytes);
-
-    return (LUB_HEAP_OK == status) ? pBlock : NULL;
-}
-/*-------------------------------------------------------- */
-void *
-memalign(unsigned alignment, 
-         unsigned size)
-{
-    return memPartAlignedAlloc(memSysPartId,size,alignment);
-}
-/*-------------------------------------------------------- */
-void *
-realloc(void *ptr, size_t nBytes)
-{
-    return memPartRealloc(memSysPartId,ptr,nBytes);
-}
-/*-------------------------------------------------------- */
-void *
-valloc(unsigned size)
-{
-    return memalign(VX_PAGE_SIZE,size);
-}
-/*-------------------------------------------------------- */

+ 0 - 339
lubheap/vxworks/memPartLib.c

@@ -1,339 +0,0 @@
-/*
- * memPartLib.c
- *
- * We undefine the public functions
- * (just in case they've been MACRO overriden
- */
-#undef free
-#undef malloc
-#undef memAddToPool
-#undef memPartAddToPool
-#undef memPartAlignedAlloc
-#undef memPartAlloc
-#undef memPartBlockIsValid
-#undef memPartCreate
-#undef memPartFree
-#undef memPartInit
-#undef memPartLibInit
-
-#include <string.h>
-#include <memPartLib.h>
-
-#define  __PROTOTYPE_5_0
-#include <semLib.h>
-#include <logLib.h>
-#include <taskLib.h>
-
-#include "private.h"
-
-/* partition used for the system heap */
-static partition_t memSysPartition;
-
-/* this must be assigned at initialisation as clients classes can be
- * initialised before the memory library, and require the value of this
- * to be set (even though they don't use the pool at that point) 
- */
-PART_ID memSysPartId = (PART_ID)&memSysPartition;
-
-static int       memPartLibInstalled;
-
-static OBJ_CLASS memPartClass;
-CLASS_ID         memPartClassId = &memPartClass;
-
-static OBJ_CLASS memPartInstrClass;
-CLASS_ID         memPartInstClassId = &memPartInstrClass;
-
-unsigned memPartOptionsDefault = 
-    (MEM_BLOCK_CHECK | MEM_ALLOC_ERROR_LOG_FLAG | MEM_BLOCK_ERROR_LOG_FLAG);
-
-/*-------------------------------------------------------- */
-static void
-memPartAllocError(partition_t *this,
-                  const char  *where,
-                  size_t       size)
-{
-    logMsg("%s: block too big - %d in partition %#x\n",
-           where,
-           size,
-           this);
-}
-/*-------------------------------------------------------- */
-static void
-memPartBlockError(partition_t *this,
-                  const char  *where,
-                  void        *block)
-{
-    logMsg("%s: invalid block %#x in partition %#x\n",
-           where,
-           block,
-           this);
-}
-/*-------------------------------------------------------- */
-void
-lubheap_vxworks_check_status(partition_t      *this,
-                             lub_heap_status_t status,
-                             const char       *where,
-                             void             *block,
-                             size_t            size)
-{
-    switch(status)
-    {
-        /*------------------------------------------------- */
-        case LUB_HEAP_CORRUPTED:
-        case LUB_HEAP_INVALID_POINTER:
-        case LUB_HEAP_DOUBLE_FREE:
-        {
-            if(this->options & MEM_BLOCK_CHECK)
-            {
-                if(this->options & MEM_BLOCK_ERROR_LOG_FLAG)
-                {
-                    memPartBlockError(this,where,block);
-                }
-                if(this->options & MEM_BLOCK_ERROR_SUSPEND_FLAG)
-                {
-                    taskSuspend(taskIdSelf());
-                }
-            }
-            break;
-        }
-        /*------------------------------------------------- */
-        case LUB_HEAP_FAILED:
-        {
-            if(this->options & MEM_ALLOC_ERROR_LOG_FLAG)
-            {
-                memPartAllocError(this,where,size);
-            }
-            if(this->options & MEM_ALLOC_ERROR_SUSPEND_FLAG)
-            {
-                taskSuspend(taskIdSelf());
-            }
-            break;
-        }
-        /*------------------------------------------------- */
-        case LUB_HEAP_OK:
-        {
-            break;
-        }
-        /*------------------------------------------------- */
-    }
-}
-/*-------------------------------------------------------- */
-void
-free(void *ptr)
-{
-    memPartFree(memSysPartId,ptr);
-}
-/*-------------------------------------------------------- */
-void *
-malloc(size_t nBytes)
-{
-    return memPartAlloc(memSysPartId,nBytes);
-}
-/*-------------------------------------------------------- */
-void
-memAddToPool(char    *pPool, 
-             unsigned poolSize)
-{
-    memPartAddToPool(memSysPartId,pPool,poolSize);
-}
-/*-------------------------------------------------------- */
-STATUS
-memPartAddToPool(PART_ID  partId, 
-                   char    *pPool,
-                   unsigned poolSize)
-{
-    partition_t  *this = (partition_t*)partId;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    lub_heap_add_segment(this->heap,pPool,poolSize);
-    semGive(&this->sem);
-
-    return OK;
-}
-/*-------------------------------------------------------- */
-void *
-memPartAlignedAlloc(PART_ID  partId, 
-                    unsigned nBytes,
-                    unsigned alignment)
-{
-    partition_t      *this   = (partition_t*)partId;
-    char             *ptr    = NULL;
-    lub_heap_status_t status = LUB_HEAP_OK;
-    lub_heap_align_t  align  = LUB_HEAP_ALIGN_NATIVE;
-
-    switch(alignment)
-    {
-        case 4:         align  = LUB_HEAP_ALIGN_2_POWER_2;  break;
-        case 8:         align  = LUB_HEAP_ALIGN_2_POWER_3;  break;
-        case 16:        align  = LUB_HEAP_ALIGN_2_POWER_4;  break;
-        case 32:        align  = LUB_HEAP_ALIGN_2_POWER_5;  break;
-        case 64:        align  = LUB_HEAP_ALIGN_2_POWER_6;  break;
-        case 128:       align  = LUB_HEAP_ALIGN_2_POWER_7;  break;
-        case 256:       align  = LUB_HEAP_ALIGN_2_POWER_8;  break;
-        case 512:       align  = LUB_HEAP_ALIGN_2_POWER_9;  break;
-        case 1024:      align  = LUB_HEAP_ALIGN_2_POWER_10; break;
-        case 2048:      align  = LUB_HEAP_ALIGN_2_POWER_11; break;
-        case 4096:      align  = LUB_HEAP_ALIGN_2_POWER_12; break;
-        case 8192:      align  = LUB_HEAP_ALIGN_2_POWER_13; break;
-        case 16384:     align  = LUB_HEAP_ALIGN_2_POWER_14; break;
-        case 32768:     align  = LUB_HEAP_ALIGN_2_POWER_15; break;
-        case 65536:     align  = LUB_HEAP_ALIGN_2_POWER_16; break;
-        case 131072:    align  = LUB_HEAP_ALIGN_2_POWER_17; break;
-        case 262144:    align  = LUB_HEAP_ALIGN_2_POWER_18; break;
-        case 524288:    align  = LUB_HEAP_ALIGN_2_POWER_19; break;
-        case 1048576:   align  = LUB_HEAP_ALIGN_2_POWER_20; break;
-        case 2097152:   align  = LUB_HEAP_ALIGN_2_POWER_21; break;
-        case 4194304:   align  = LUB_HEAP_ALIGN_2_POWER_22; break;
-        case 8388608:   align  = LUB_HEAP_ALIGN_2_POWER_23; break;
-        case 16777216:  align  = LUB_HEAP_ALIGN_2_POWER_24; break;
-        case 33554432:  align  = LUB_HEAP_ALIGN_2_POWER_25; break;
-        case 67108864:  align  = LUB_HEAP_ALIGN_2_POWER_26; break;
-        case 134217728: align  = LUB_HEAP_ALIGN_2_POWER_27; break;
-        default:        status = LUB_HEAP_FAILED;           break;
-    }
-    if(LUB_HEAP_OK == status)
-    {
-        semTake(&this->sem,WAIT_FOREVER);
-        status = lub_heap_realloc(this->heap,&ptr,nBytes,align);
-        semGive(&this->sem);
-    }
-    lubheap_vxworks_check_status(this,
-                                 status,
-                                 "memPartAlignedAlloc",
-                                 NULL,
-                                 nBytes);
-    return ptr;
-}
-/*-------------------------------------------------------- */
-void *
-memPartAlloc(PART_ID  partId, 
-             unsigned nBytes)
-{
-    partition_t      *this = (partition_t*)partId;
-    char             *ptr  = NULL;
-    lub_heap_status_t status;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    status = lub_heap_realloc(this->heap,&ptr,nBytes,LUB_HEAP_ALIGN_NATIVE);
-    semGive(&this->sem);
-
-    lubheap_vxworks_check_status(this,status,"memPartAlloc",NULL,nBytes);
-
-    return ptr;
-}
-/*-------------------------------------------------------- */
-BOOL
-memPartBlockIsValid(PART_ID    partId, 
-                    BLOCK_HDR *pHdr,
-                    BOOL       isFree)
-{
-    partition_t *this = (partition_t*)partId;
-    bool_t       result;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    result = lub_heap_validate_pointer(this->heap,(char*)pHdr);
-    semGive(&this->sem);
-
-    return (BOOL_TRUE == result) ? TRUE : FALSE;
-}
-/*-------------------------------------------------------- */
-PART_ID
-memPartCreate(char    *pPool, 
-              unsigned poolSize)
-{
-    partition_t *this = objAlloc(memPartClassId);
-    
-    memPartInit((PART_ID)this,pPool,poolSize);
-    
-    return (PART_ID)this;
-}
-/*-------------------------------------------------------- */
-static void
-memPartDestroy(PART_ID partId)
-{
-    partition_t *this = (partition_t*)partId;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    lub_heap_destroy(this->heap);
-    this->heap = 0;
-    objCoreTerminate(&this->objCore);
-    semGive(&this->sem);
-
-    objFree(memPartClassId,(char*)this);
-}
-/*-------------------------------------------------------- */
-STATUS
-memPartFree(PART_ID partId, 
-            char   *pBlock)
-{
-    partition_t        *this = (partition_t*)partId;
-    lub_heap_status_t status;
-
-    if(OK == OBJ_VERIFY(pBlock,memPartClassId))
-    {
-        /* we are releasing a memory partition */
-        memPartDestroy((PART_ID)pBlock);
-        status = LUB_HEAP_OK;
-    }
-    else
-    {
-        /* we are simply releasing memory */
-        semTake(&this->sem,WAIT_FOREVER);
-        status = lub_heap_realloc(this->heap,&pBlock,0,LUB_HEAP_ALIGN_NATIVE);
-        semGive(&this->sem);
-    }
-
-    lubheap_vxworks_check_status(this,status,"memPartFree",pBlock,0);
-    
-    return (LUB_HEAP_OK == status) ? OK : ERROR;
-}
-/*-------------------------------------------------------- */
-void
-memPartInit(PART_ID  partId,
-            char    *pPool,
-            unsigned poolSize)
-{
-    partition_t  *this = (partition_t*)partId;
-    
-    memset(this,0,sizeof(partition_t));
-    
-    /* initialise the core object */
-    objCoreInit(&this->objCore,memPartClassId);
-
-    /* set the default options */
-    this->options = memPartOptionsDefault;
-
-    /* initialise the semaphore for the partition */
-    semMInit(&this->sem,
-             SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE);
-    
-    /* create the heap */
-    this->heap = lub_heap_create(pPool,poolSize);
-}
-/*-------------------------------------------------------- */
-STATUS
-memPartLibInit(char    *pPool, 
-               unsigned poolSize)
-{
-    if(!memPartLibInstalled)
-    {
-        memPartLibInstalled = 1;
-
-        classInit(memPartClassId,
-                  sizeof(partition_t),
-                  offsetof(partition_t,objCore),
-                  (FUNCPTR)memPartCreate,
-                  (FUNCPTR)memPartInit,
-                  (FUNCPTR)memPartDestroy);
-    
-        classInstrument(memPartClassId,memPartInstClassId);
-
-        /* now initialise the system partition instance */
-        memPartInit((PART_ID)&memSysPartition,
-                    pPool,
-                    poolSize);
-
-    }
-    return OK;
-}
-/*-------------------------------------------------------- */

+ 0 - 52
lubheap/vxworks/memShow.c

@@ -1,52 +0,0 @@
-#include <memLib.h>
-
-#include "private.h"
-
-/*-------------------------------------------------------- */
-STATUS
-memPartInfoGet(PART_ID         partId, 
-               MEM_PART_STATS *ppartStats)
-{
-    partition_t       *this = (partition_t*)partId;
-    lub_heap_stats_t stats;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-    lub_heap__get_stats(this->heap,&stats);
-    ppartStats->maxBlockSizeFree = lub_heap__get_max_free(this->heap);
-    semGive(&this->sem);
-
-    /* now fill out the statistics */
-    ppartStats->numBytesFree   = stats.free_bytes;
-    ppartStats->numBlocksFree  = stats.free_blocks;
-    ppartStats->numBytesAlloc  = stats.alloc_bytes;
-    ppartStats->numBlocksAlloc = stats.alloc_blocks;
-
-    return OK;
-}
-/*-------------------------------------------------------- */
-STATUS
-memPartShow(PART_ID partId, 
-            int     type)
-{
-    partition_t *this = (partition_t*)partId;
-    
-    semTake(&this->sem,WAIT_FOREVER);
-
-    lub_heap_show(this->heap,type);
-
-    semGive(&this->sem);
-
-    return OK;
-}
-/*-------------------------------------------------------- */
-void 
-memShow(int type)
-{
-    memPartShow(memSysPartId,type);
-}
-/*-------------------------------------------------------- */
-void
-memShowInit (void)
-{
-}
-/*--------------------------------------------------------- */

+ 0 - 5
lubheap/vxworks/module.am

@@ -1,5 +0,0 @@
-EXTRA_DIST  +=                   \
-    lubheap/vxworks/memLib.c     \
-    lubheap/vxworks/memPartLib.c \
-    lubheap/vxworks/memShow.c    \
-    lubheap/vxworks/private.h

+ 0 - 20
lubheap/vxworks/private.h

@@ -1,20 +0,0 @@
-#include <private/semLibP.h>
-#include <private/classLibP.h>
-
-#include "lub/heap.h"
-
-typedef struct partition_s partition_t;
-struct partition_s
-{
-    OBJ_CORE    objCore;   /* object management        */
-    SEMAPHORE   sem;       /* partition semaphore      */
-    unsigned    options;   /* options                  */
-    lub_heap_t *heap;      /* reference to heap object */
-};
-
-extern void
-    lubheap_vxworks_check_status(partition_t *this,
-                                 lub_heap_status_t status,
-                                 const char       *where,
-                                 void             *block,
-                                 size_t            size);

Some files were not shown because too many files changed in this diff