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/07/06 12:39:12 UTC

[incubator-nuttx] branch master updated: fs/procfs: layout the output of meminfo correctly

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


The following commit(s) were added to refs/heads/master by this push:
     new d5c1979  fs/procfs: layout the output of meminfo correctly
d5c1979 is described below

commit d5c1979aada8ae68159ab26cecd13a0c0d388cde
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Jul 6 01:35:55 2021 -0700

    fs/procfs: layout the output of meminfo correctly
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Ic30e70772e19a43e2ad3b298e3ba1ac77f2f2219
---
 fs/procfs/fs_procfsmeminfo.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c
index 3f2d1a4..711d527 100644
--- a/fs/procfs/fs_procfsmeminfo.c
+++ b/fs/procfs/fs_procfsmeminfo.c
@@ -286,10 +286,9 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
 
   /* The first line is the headers */
 
-  linesize  =
-    procfs_snprintf(procfile->line, MEMINFO_LINELEN,
-             "                     "
-             "total       used       free    largest  nused  nfree\n");
+  linesize  = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
+                              "%13s%11s%11s%11s%11s%7s%7s\n", "", "total",
+                              "used", "free", "largest", "nused", "nfree");
 
   copysize  = procfs_memcpy(procfile->line, linesize, buffer, buflen,
                             &offset);
@@ -312,8 +311,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
 
           entry->mallinfo(entry->user_data, &minfo);
           linesize   = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
-                                       "%12s:  "
-                                       "%11lu%11lu%11lu%11lu%7lu%7lu\n",
+                                       "%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
                                        entry->name,
                                        (unsigned long)minfo.arena,
                                        (unsigned long)minfo.uordblks,
@@ -349,8 +347,8 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
       max        = (unsigned long)pginfo.mxfree << MM_PGSHIFT;
 
       linesize   = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
-                                   "Page:  %11lu%11lu%11lu%11lu\n",
-                                   total, allocated, available, max);
+                                   "%12s:%11lu%11lu%11lu%11lu\n",
+                                   "Page", total, allocated, available, max);
 
       copysize   = procfs_memcpy(procfile->line, linesize, buffer, buflen,
                                  &offset);
@@ -371,7 +369,8 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
       meminfo_progmem(&progmem);
 
       linesize   = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
-                                   "Prog:  %11lu%11lu%11lu%11lu%7lu%7lu\n",
+                                   "%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
+                                   "Prog",
                                    (unsigned long)progmem.arena,
                                    (unsigned long)progmem.uordblks,
                                    (unsigned long)progmem.fordblks,