profcs: At file to should user space heap. This replaces the NSH free command.

This commit is contained in:
Gregory Nutt
2017-11-13 12:51:33 -06:00
parent ea795c8cca
commit 070d40260b
6 changed files with 53 additions and 23 deletions
+35 -20
View File
@@ -61,11 +61,11 @@
#undef KMALLOC_EXTERN
#if defined(__cplusplus)
# define KMALLOC_EXTERN extern "C"
# define KMALLOC_EXTERN extern "C"
extern "C"
{
#else
# define KMALLOC_EXTERN extern
# define KMALLOC_EXTERN extern
#endif
/****************************************************************************
@@ -94,6 +94,11 @@ extern "C"
#define kumm_realloc(p,s) realloc(p,s)
#define kumm_memalign(a,s) memalign(a,s)
#define kumm_free(p) free(p)
#ifdef CONFIG_CAN_PASS_STRUCTS
# define kumm_mallinfo() mallinfo()
#else
# define kumm_mallinfo(i) mallinfo(i)
#endif
/* This family of allocators is used to manage kernel protected memory */
@@ -102,16 +107,21 @@ extern "C"
* as were used for the user-mode function.
*/
# define kmm_initialize(h,s) /* Initialization done by kumm_initialize */
# define kmm_addregion(h,s) umm_addregion(h,s)
# define kmm_trysemaphore() umm_trysemaphore()
# define kmm_givesemaphore() umm_givesemaphore()
# define kmm_initialize(h,s) /* Initialization done by kumm_initialize */
# define kmm_addregion(h,s) umm_addregion(h,s)
# define kmm_trysemaphore() umm_trysemaphore()
# define kmm_givesemaphore() umm_givesemaphore()
# define kmm_malloc(s) malloc(s)
# define kmm_zalloc(s) zalloc(s)
# define kmm_realloc(p,s) realloc(p,s)
# define kmm_memalign(a,s) memalign(a,s)
# define kmm_free(p) free(p)
# define kmm_malloc(s) malloc(s)
# define kmm_zalloc(s) zalloc(s)
# define kmm_realloc(p,s) realloc(p,s)
# define kmm_memalign(a,s) memalign(a,s)
# define kmm_free(p) free(p)
#ifdef CONFIG_CAN_PASS_STRUCTS
# define kmm_mallinfo() mallinfo()
#else
# define kmm_mallinfo(i) mallinfo(i)
#endif
#elif !defined(CONFIG_MM_KERNEL_HEAP)
/* If this the kernel phase of a kernel build, and there are only user-space
@@ -119,16 +129,21 @@ extern "C"
* call into user-space via a header at the beginning of the user-space blob.
*/
# define kmm_initialize(h,s) /* Initialization done by kumm_initialize */
# define kmm_addregion(h,s) umm_addregion(h,s)
# define kmm_trysemaphore() umm_trysemaphore()
# define kmm_givesemaphore() umm_givesemaphore()
# define kmm_initialize(h,s) /* Initialization done by kumm_initialize */
# define kmm_addregion(h,s) umm_addregion(h,s)
# define kmm_trysemaphore() umm_trysemaphore()
# define kmm_givesemaphore() umm_givesemaphore()
# define kmm_malloc(s) umm_malloc(s)
# define kmm_zalloc(s) umm_zalloc(s)
# define kmm_realloc(p,s) umm_realloc(p,s)
# define kmm_memalign(a,s) umm_memalign(a,s)
# define kmm_free(p) umm_free(p)
# define kmm_malloc(s) malloc(s)
# define kmm_zalloc(s) zalloc(s)
# define kmm_realloc(p,s) realloc(p,s)
# define kmm_memalign(a,s) memalign(a,s)
# define kmm_free(p) free(p)
#ifdef CONFIG_CAN_PASS_STRUCTS
# define kmm_mallinfo() mallinfo()
#else
# define kmm_mallinfo(i) mallinfo(i)
#endif
#else
/* Otherwise, the kernel-space allocators are declared in include/nuttx/mm/mm.h
+2 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/mm/mm.h
*
* Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* If the MCU has a small (16-bit) address capability, then we will use
* a smaller chunk header that contains 16-bit size/offset information.