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 David Sidrane
parent 9976635390
commit d5c1979aad

View File

@ -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,