<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: &lt;P@draigBrady.com&gt;

Make smaps output match the maps output, as smaps was not showing info like
which map was heap and stack etc.  The code is smaller also, as show_smap()
now just calls show_map().

Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 fs/proc/task_mmu.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diff -puN fs/proc/task_mmu.c~smaps-print-more-fields fs/proc/task_mmu.c
--- devel/fs/proc/task_mmu.c~smaps-print-more-fields	2005-07-12 17:18:17.000000000 -0700
+++ devel-akpm/fs/proc/task_mmu.c	2005-07-12 17:18:17.000000000 -0700
@@ -123,9 +123,9 @@ static int show_map(struct seq_file *m, 
 	 * Print the dentry name for named mappings, and a
 	 * special [heap] marker for the heap:
 	 */
-	if (vma-&gt;vm_file) {
+	if (file) {
 		pad_len_spaces(m, len);
-		seq_path(m, file-&gt;f_vfsmnt, file-&gt;f_dentry, "");
+		seq_path(m, file-&gt;f_vfsmnt, file-&gt;f_dentry, "\n");
 	} else {
 		if (mm) {
 			if (vma-&gt;vm_start &lt;= mm-&gt;start_brk &amp;&amp;
@@ -247,32 +247,21 @@ static inline void smaps_pgd_range(struc
 static int show_smap(struct seq_file *m, void *v)
 {
 	struct vm_area_struct *vma = v;
-	struct file *file = vma-&gt;vm_file;
-	int flags = vma-&gt;vm_flags;
 	struct mm_struct *mm = vma-&gt;vm_mm;
 	unsigned long vma_len = (vma-&gt;vm_end - vma-&gt;vm_start);
 	struct mem_size_stats mss;
 
 	memset(&amp;mss, 0, sizeof mss);
 
+	show_map(m, v);
+
 	if (mm) {
 		spin_lock(&amp;mm-&gt;page_table_lock);
 		smaps_pgd_range(vma, vma-&gt;vm_start, vma-&gt;vm_end, &amp;mss);
 		spin_unlock(&amp;mm-&gt;page_table_lock);
 	}
 
-	seq_printf(m, "%08lx-%08lx %c%c%c%c ",
-		   vma-&gt;vm_start,
-		   vma-&gt;vm_end,
-		   flags &amp; VM_READ ? 'r' : '-',
-		   flags &amp; VM_WRITE ? 'w' : '-',
-		   flags &amp; VM_EXEC ? 'x' : '-',
-		   flags &amp; VM_MAYSHARE ? 's' : 'p');
-
-	if (vma-&gt;vm_file)
-		seq_path(m, file-&gt;f_vfsmnt, file-&gt;f_dentry, " \t\n\\");
-
-	seq_printf(m, "\n"
+	seq_printf(m,
 		   "Size:          %8lu kB\n"
 		   "Rss:           %8lu kB\n"
 		   "Shared_Clean:  %8lu kB\n"
_
</pre></body></html>