Skip to content

Commit

Permalink
procfs/meminfo: fit line width in 80 chars
Browse files Browse the repository at this point in the history
This makes `free` output line width to fit in most terminals.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 authored and xiaoxiang781216 committed Apr 24, 2024
1 parent 918e384 commit 49fbc26
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/procfs/fs_procfsmeminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ 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,
"%13s%11s%11s%11s%11s%11s%7s%7s\n", "",
"%11s%11s%11s%11s%11s%11s%7s%7s\n", "",
"total", "used", "free", "maxused",
"maxfree", "nused", "nfree");

Expand All @@ -318,7 +318,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,

info = mm_mallinfo(entry->heap);
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
"%12s:%11lu%11lu%11lu%11lu%11lu"
"%10s:%11lu%11lu%11lu%11lu%11lu"
"%7lu%7lu\n", entry->name,
(unsigned long)info.arena,
(unsigned long)info.uordblks,
Expand Down Expand Up @@ -355,7 +355,7 @@ 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,
"%12s:%11lu%11lu%11lu%11lu\n",
"%10s:%11lu%11lu%11lu%11lu\n",
"Page", total, allocated, available, max);

copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
Expand All @@ -377,7 +377,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
meminfo_progmem(&progmem);

linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
"%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
"%10s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
"Prog",
(unsigned long)progmem.arena,
(unsigned long)progmem.uordblks,
Expand Down

0 comments on commit 49fbc26

Please sign in to comment.