You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2021/02/12 11:16:18 UTC

[incubator-nuttx] 06/07: esp32_modtext.c: Report the usage with procfs_register_meminfo

This is an automated email from the ASF dual-hosted git repository.

davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7bb849535c798866ea45c9252aacebb7b527982b
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Feb 12 14:20:54 2021 +0900

    esp32_modtext.c: Report the usage with procfs_register_meminfo
---
 arch/xtensa/src/esp32/esp32_modtext.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/xtensa/src/esp32/esp32_modtext.c b/arch/xtensa/src/esp32/esp32_modtext.c
index fc7d78d..8558661 100644
--- a/arch/xtensa/src/esp32/esp32_modtext.c
+++ b/arch/xtensa/src/esp32/esp32_modtext.c
@@ -24,6 +24,7 @@
 
 #include <nuttx/config.h>
 #include <nuttx/arch.h>
+#include <nuttx/fs/procfs.h>
 #include <nuttx/mm/mm.h>
 
 #include <sys/types.h>
@@ -57,6 +58,15 @@ struct mm_heap_s g_module_text;
 void up_module_text_init()
 {
   mm_initialize(&g_module_text, &_smodtext, &_emodtext - &_smodtext);
+
+#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
+  static struct procfs_meminfo_entry_s g_modtext_procfs;
+
+  g_modtext_procfs.name = "modtext";
+  g_modtext_procfs.mallinfo = (void *)mm_mallinfo;
+  g_modtext_procfs.user_data = &g_module_text;
+  procfs_register_meminfo(&g_modtext_procfs);
+#endif
 }
 
 /****************************************************************************