pmap: Fix output format of VmFlags.
In the headers, the space was misplaced; for example, "pmap -XX $$" outputs "VmFlagsMapping" (without a space). Use justify_print() instead of printf(). There was also an extra space in the output, because vmflags[] (from the "VmFlags:" line) always ends with a space. Overwriting this last space with a null byte fixes this misalignment.
This commit is contained in:
parent
62de3a2aa7
commit
8c84870d83
6
pmap.c
6
pmap.c
@ -392,9 +392,11 @@ loop_end:
|
|||||||
/* === GET VMFLAGS === */
|
/* === GET VMFLAGS === */
|
||||||
nfields = ret ? sscanf(mapbuf, "VmFlags: %"VMFL"[a-z ]", vmflags) : 0;
|
nfields = ret ? sscanf(mapbuf, "VmFlags: %"VMFL"[a-z ]", vmflags) : 0;
|
||||||
if (nfields == 1) {
|
if (nfields == 1) {
|
||||||
|
int len = strlen(vmflags);
|
||||||
|
if (len > 0 && vmflags[len-1] == ' ') vmflags[--len] = '\0';
|
||||||
|
if (len > maxwv) maxwv = len;
|
||||||
if (! has_vmflags) has_vmflags = 1;
|
if (! has_vmflags) has_vmflags = 1;
|
||||||
ret = fgets(mapbuf, sizeof mapbuf, f);
|
ret = fgets(mapbuf, sizeof mapbuf, f);
|
||||||
if (strlen(vmflags) > maxwv) maxwv = strlen(vmflags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstmapping == 2) { /* width measurement stage, do not print anything yet */
|
if (firstmapping == 2) { /* width measurement stage, do not print anything yet */
|
||||||
@ -437,7 +439,7 @@ loop_end:
|
|||||||
justify_print(listnode->description, listnode->max_width, 1);
|
justify_print(listnode->description, listnode->max_width, 1);
|
||||||
|
|
||||||
if (has_vmflags && is_enabled("VmFlags"))
|
if (has_vmflags && is_enabled("VmFlags"))
|
||||||
printf(" %*s", maxwv, "VmFlags");
|
maxwv = justify_print("VmFlags", maxwv, 1);
|
||||||
|
|
||||||
if (is_enabled(nls_Mapping))
|
if (is_enabled(nls_Mapping))
|
||||||
justify_print(nls_Mapping, 0, 0);
|
justify_print(nls_Mapping, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user