fs/procfs: layout the output of meminfo correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic30e70772e19a43e2ad3b298e3ba1ac77f2f2219
This commit is contained in:
Xiang Xiao
2021-07-06 01:35:55 -07:00
committed by xiaoxiang
parent 560a86ff57
commit bf83a3253f
+16 -15
View File
@@ -287,9 +287,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);
@@ -311,15 +311,15 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
/* Show heap information */
entry->mallinfo(entry->user_data, &minfo);
linesize = snprintf(procfile->line, MEMINFO_LINELEN,
"%12s: %11lu%11lu%11lu%11lu%7lu%7lu\n",
entry->name,
(unsigned long)minfo.arena,
(unsigned long)minfo.uordblks,
(unsigned long)minfo.fordblks,
(unsigned long)minfo.mxordblk,
(unsigned long)minfo.aordblks,
(unsigned long)minfo.ordblks);
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
"%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
entry->name,
(unsigned long)minfo.arena,
(unsigned long)minfo.uordblks,
(unsigned long)minfo.fordblks,
(unsigned long)minfo.mxordblk,
(unsigned long)minfo.aordblks,
(unsigned long)minfo.ordblks);
copysize = procfs_memcpy(procfile->line, linesize, buffer,
buflen, &offset);
totalsize += copysize;
@@ -348,8 +348,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);
@@ -370,7 +370,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,