From 32ac190552c7271cc10426fbed1efa290b271aab Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Wed, 22 Jan 2025 14:07:34 +0800 Subject: [PATCH 1/2] libc/modlib: guard modname field usage This guards `.modname` field usage with same condition as header definitions. Signed-off-by: Yanfeng Liu --- libs/libc/modlib/modlib_insert.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/libc/modlib/modlib_insert.c b/libs/libc/modlib/modlib_insert.c index c9faac0cdad06..19a6ab320c03d 100644 --- a/libs/libc/modlib/modlib_insert.c +++ b/libs/libc/modlib/modlib_insert.c @@ -115,7 +115,9 @@ void modlib_dumploadinfo(FAR struct mod_loadinfo_s *loadinfo) void modlib_dumpmodule(FAR struct module_s *modp) { binfo("Module:\n"); +#ifdef HAVE_MODLIB_NAMES binfo(" modname: %s\n", modp->modname); +#endif binfo(" textalloc: %08lx\n", (long)modp->textalloc); #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE) binfo(" dataalloc: %08lx\n", (long)modp->dataalloc); @@ -136,7 +138,11 @@ void modlib_dumpmodule(FAR struct module_s *modp) binfo(" dependents: %d\n", modp->dependents); for (int i = 0; i < modp->dependents; i++) { +# ifdef HAVE_MODLIB_NAMES binfo("%d %s\n", i, modp->dependencies[i]->modname); +# else + binfo("%d\n", i); +# endif modlib_dumpmodule(modp->dependencies[i]); } #endif From 1a69062b2d5141738305100ca306ad26ee6e54f6 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Wed, 22 Jan 2025 14:11:48 +0800 Subject: [PATCH 2/2] procfs/meminfo: align page fields to columns meminfo before: ``` total used free maxused maxfree nused nfree name 3129344 10824 3118520 11184 3118104 25 2 Kmem 13631488 1114112 12517376 12517376 Page ``` and after: ``` total used free maxused maxfree nused nfree name 3129344 10824 3118520 11184 3118104 25 2 Kmem 13631488 1114112 12517376 12517376 Page ``` Signed-off-by: Yanfeng Liu --- fs/procfs/fs_procfsmeminfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c index df4b11595fcb3..0f6620e625bb1 100644 --- a/fs/procfs/fs_procfsmeminfo.c +++ b/fs/procfs/fs_procfsmeminfo.c @@ -367,8 +367,8 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer, max = (unsigned long)pg_info.mxfree << MM_PGSHIFT; linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN, - "%11lu%11lu%11lu%11lu %s\n", - total, allocated, available, max, "Page"); + "%11lu%11lu%11lu%11s%11lu %18s\n", total, + allocated, available, "", max, "Page"); copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen, &offset);