diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/task_nommu.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 46d4b5d72bd3..cb6306e63843 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -122,11 +122,20 @@ int task_statm(struct mm_struct *mm, int *shared, int *text, | |||
122 | return size; | 122 | return size; |
123 | } | 123 | } |
124 | 124 | ||
125 | static void pad_len_spaces(struct seq_file *m, int len) | ||
126 | { | ||
127 | len = 25 + sizeof(void*) * 6 - len; | ||
128 | if (len < 1) | ||
129 | len = 1; | ||
130 | seq_printf(m, "%*c", len, ' '); | ||
131 | } | ||
132 | |||
125 | /* | 133 | /* |
126 | * display a single VMA to a sequenced file | 134 | * display a single VMA to a sequenced file |
127 | */ | 135 | */ |
128 | static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) | 136 | static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) |
129 | { | 137 | { |
138 | struct mm_struct *mm = vma->vm_mm; | ||
130 | unsigned long ino = 0; | 139 | unsigned long ino = 0; |
131 | struct file *file; | 140 | struct file *file; |
132 | dev_t dev = 0; | 141 | dev_t dev = 0; |
@@ -155,11 +164,14 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) | |||
155 | MAJOR(dev), MINOR(dev), ino, &len); | 164 | MAJOR(dev), MINOR(dev), ino, &len); |
156 | 165 | ||
157 | if (file) { | 166 | if (file) { |
158 | len = 25 + sizeof(void *) * 6 - len; | 167 | pad_len_spaces(m, len); |
159 | if (len < 1) | ||
160 | len = 1; | ||
161 | seq_printf(m, "%*c", len, ' '); | ||
162 | seq_path(m, &file->f_path, ""); | 168 | seq_path(m, &file->f_path, ""); |
169 | } else if (mm) { | ||
170 | if (vma->vm_start <= mm->start_stack && | ||
171 | vma->vm_end >= mm->start_stack) { | ||
172 | pad_len_spaces(m, len); | ||
173 | seq_puts(m, "[stack]"); | ||
174 | } | ||
163 | } | 175 | } |
164 | 176 | ||
165 | seq_putc(m, '\n'); | 177 | seq_putc(m, '\n'); |