gonzui


Format: Advanced Search

mtkernel_3/lib/libtk/kmalloc.cbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    micro T-Kernel 3.00.02
    4:  *
    5:  *    Copyright (C) 2006-2020 by Ken Sakamura.
    6:  *    This software is distributed under the T-License 2.2.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by TRON Forum(http://www.tron.org) at 2020/10/21 .
   10:  *
   11:  *----------------------------------------------------------------------
   12:  */
   13: 
   14: /*
   15:  *      kmalloc.c
   16:  *
   17:  *      Memory allocation (Kmalloc)
   18:  */
   19: 
   20: #include <tk/tkernel.h>
   21: 
   22: #if TK_SUPPORT_MEMLIB
   23: 
   24: /* --------------------------------------------------------------------- */
   25: /*
   26:  * Systmem internal memory management call 
   27:  *      These calls must not be called directly from the user program.
   28:  */
   29: IMPORT void* knl_Imalloc( SZ size );
   30: IMPORT void* knl_Icalloc( SZ nmemb, SZ size );
   31: IMPORT void* knl_Irealloc( void *ptr, SZ size );
   32: IMPORT void  knl_Ifree( void *ptr );
   33: 
   34: 
   35: /* --------------------------------------------------------------------- */
   36: /*
   37:  * Memory allocation API definition
   38:  */
   39: EXPORT void* Kmalloc( size_t size )
   40: {
   41:         return knl_Imalloc(size);
   42: }
   43: 
   44: EXPORT void* Kcalloc( size_t nmemb, size_t size )
   45: {
   46:         return knl_Icalloc(nmemb, size);
   47: }
   48: 
   49: EXPORT void *Krealloc( void *ptr, size_t size)
   50: {
   51:         return knl_Irealloc(ptr, size);
   52: }
   53: 
   54: EXPORT void Kfree( void *ptr )
   55: {
   56:         knl_Ifree(ptr);
   57: }
   58: 
   59: #endif /* TK_SUPPORT_MEMLIB */