profcs: At file to should user space heap. This replaces the NSH free command.
This commit is contained in:
parent
ea795c8cca
commit
070d40260b
@ -115,5 +115,10 @@ config FS_PROCFS_EXCLUDE_SMARTFS
|
||||
depends on FS_SMARTFS
|
||||
default n
|
||||
|
||||
config FS_PROCFS_EXCLUDE_UMM
|
||||
bool "Exclude umm"
|
||||
depends on !BUILD_KERNEL
|
||||
default n
|
||||
|
||||
endmenu #
|
||||
endif # FS_PROCFS
|
||||
|
@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# fs/procfs/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -40,6 +40,10 @@ ASRCS +=
|
||||
CSRCS += fs_procfs.c fs_procfsutil.c fs_procfsproc.c fs_procfsuptime.c
|
||||
CSRCS += fs_procfscpuload.c fs_procfskmm.c
|
||||
|
||||
ifneq ($(CONFIG_BUILD_KERNEL),y)
|
||||
CSRCS += fs_procfsumm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_HAVE_PROGMEM),y)
|
||||
CSRCS += fs_procfsprogmem.c
|
||||
endif
|
||||
|
@ -79,6 +79,7 @@
|
||||
extern const struct procfs_operations proc_operations;
|
||||
extern const struct procfs_operations cpuload_operations;
|
||||
extern const struct procfs_operations kmm_operations;
|
||||
extern const struct procfs_operations umm_operations;
|
||||
extern const struct procfs_operations progmem_operations;
|
||||
extern const struct procfs_operations module_operations;
|
||||
extern const struct procfs_operations uptime_operations;
|
||||
@ -170,6 +171,10 @@ static const struct procfs_entry_s g_procfs_entries[] =
|
||||
{ "progmem", &progmem_operations, PROCFS_FILE_TYPE },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS_EXCLUDE_UMM) && !defined(CONFIG_BUILD_KERNEL)
|
||||
{ "umm", &umm_operations, PROCFS_FILE_TYPE },
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS_EXCLUDE_UPTIME)
|
||||
{ "uptime", &uptime_operations, PROCFS_FILE_TYPE },
|
||||
#endif
|
||||
|
@ -240,7 +240,7 @@ static ssize_t kmm_read(FAR struct file *filep, FAR char *buffer,
|
||||
#endif
|
||||
|
||||
linesize = snprintf(procfile->line, KMM_LINELEN,
|
||||
"Mem: %11d%11d%11d%11d\n",
|
||||
"Kmem: %11d%11d%11d%11d\n",
|
||||
mem.arena, mem.uordblks, mem.fordblks,
|
||||
mem.mxordblk);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user