1 Index: fs/proc/task_nommu.c
2 ===================================================================
3 RCS file: /usr/local/src/blackfin/rsync/uclinux533/uClinux-dist/linux-2.6.x/fs/proc/task_nommu.c,v
4 retrieving revision 1.4
5 diff -u -p -r1.4 task_nommu.c
6 --- fs/proc/task_nommu.c 12 Aug 2005 04:12:03 -0000 1.4
7 +++ fs/proc/task_nommu.c 25 Aug 2006 23:03:47 -0000
8 @@ -141,20 +141,227 @@ out:
9 * Albert D. Cahalan suggested to fake entries for the traditional
10 * sections here. This might be worth investigating.
12 +static void pad_len_spaces(struct seq_file *m, int len)
14 + len = 25 + sizeof(void*) * 6 - len;
17 + seq_printf(m, "%*c", len, ' ');
20 static int show_map(struct seq_file *m, void *v)
22 + struct task_struct *task = m->private;
23 + struct vm_area_struct *vma = v;
24 + struct mm_struct *mm = vma->vm_mm;
25 + struct file *file = vma->vm_file;
26 + int flags = vma->vm_flags;
27 + unsigned long ino = 0;
31 +printk("!!! BOOYA %s\n", __FUNCTION__);
34 + struct inode *inode = vma->vm_file->f_dentry->d_inode;
35 + dev = inode->i_sb->s_dev;
39 + seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
42 + flags & VM_READ ? 'r' : '-',
43 + flags & VM_WRITE ? 'w' : '-',
44 + flags & VM_EXEC ? 'x' : '-',
45 + flags & VM_MAYSHARE ? 's' : 'p',
46 + vma->vm_pgoff << PAGE_SHIFT,
47 + MAJOR(dev), MINOR(dev), ino, &len);
50 + * Print the dentry name for named mappings, and a
51 + * special [heap] marker for the heap:
54 + pad_len_spaces(m, len);
55 + seq_path(m, file->f_vfsmnt, file->f_dentry, "\n");
58 + if (vma->vm_start <= mm->start_brk &&
59 + vma->vm_end >= mm->brk) {
60 + pad_len_spaces(m, len);
61 + seq_puts(m, "[heap]");
63 + if (vma->vm_start <= mm->start_stack &&
64 + vma->vm_end >= mm->start_stack) {
66 + pad_len_spaces(m, len);
67 + seq_puts(m, "[stack]");
71 + pad_len_spaces(m, len);
72 + seq_puts(m, "[vdso]");
82 + "Shared_Clean: %8lu kB\n"
83 + "Shared_Dirty: %8lu kB\n"
84 + "Private_Clean: %8lu kB\n"
85 + "Private_Dirty: %8lu kB\n",
86 + (vma->vm_end - vma->vm_start) >> 10,
87 + mss->resident >> 10,
88 + mss->shared_clean >> 10,
89 + mss->shared_dirty >> 10,
90 + mss->private_clean >> 10,
91 + mss->private_dirty >> 10);
93 +#define get_gate_vma(x) NULL
94 + if (m->count < m->size) /* vma is copied successfully */
95 + m->version = (vma != get_gate_vma(task))? vma->vm_start: 0;
98 static void *m_start(struct seq_file *m, loff_t *pos)
101 + struct task_struct *task = m->private;
102 + unsigned long last_addr = m->version;
103 + struct mm_struct *mm;
104 + struct vm_area_struct *vma, *tail_vma;
105 + struct vm_list_struct *vml;
107 +printk("!!! BOOYA %s\n", __FUNCTION__);
108 +printk("%s:%i: %p %lu \n", __FUNCTION__, __LINE__, task, last_addr);
110 + * We remember last_addr rather than next_addr to hit with
111 + * mmap_cache most of the time. We have zero last_addr at
112 + * the beginning and also after lseek. We will have -1 last_addr
113 + * after the end of the vmas.
116 + if (last_addr == -1UL)
118 +printk("%s:%i: \n", __FUNCTION__, __LINE__);
120 + mm = get_task_mm(task);
123 +printk("%s:%i: mm=%p \n", __FUNCTION__, __LINE__, mm);
125 + for (vml = mm->context.vmlist; vml; vml = vml->next) {
129 + unsigned long ino = 0;
131 +int flags = vma->vm_flags;
132 + struct file *file = vma->vm_file;
134 + struct inode *inode = vma->vm_file->f_dentry->d_inode;
135 + dev = inode->i_sb->s_dev;
136 + ino = inode->i_ino;
138 +// printk("%s:%i: %p: %lu -> %lu\n", __FUNCTION__, __LINE__, vml->vma,
139 +// vml->vma->vm_start, vml->vma->vm_end);
140 +printk("MAPS: %08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n ",
143 + flags & VM_READ ? 'r' : '-',
144 + flags & VM_WRITE ? 'w' : '-',
145 + flags & VM_EXEC ? 'x' : '-',
146 + flags & VM_MAYSHARE ? 's' : 'p',
147 + vma->vm_pgoff << PAGE_SHIFT,
148 + MAJOR(dev), MINOR(dev), ino);
150 +p = d_path(file->f_dentry, file->f_vfsmnt, _tmpbuf, sizeof(_tmpbuf));
155 + if (vma->vm_start <= mm->start_brk &&
156 + vma->vm_end >= mm->brk) {
159 + if (vma->vm_start <= mm->start_stack &&
160 + vma->vm_end >= mm->start_stack) {
162 + printk(" [stack]");
169 +// if (addr >= vml->vma->vm_start && addr < vml->vma->vm_end)
173 + tail_vma = get_gate_vma(task);
174 + down_read(&mm->mmap_sem);
176 + /* Start with last addr hint */
177 + if (last_addr && (vma = find_vma(mm, last_addr))) {
178 + vma = vma->vm_next;
181 +printk("%s:%i: \n", __FUNCTION__, __LINE__);
184 + * Check the vma index is within the range and do
185 + * sequential scan until m_index.
188 + if ((unsigned long)l < mm->map_count) {
191 + vma = vma->vm_next;
194 +printk("%s:%i: \n", __FUNCTION__, __LINE__);
196 + if (l != mm->map_count)
197 + tail_vma = NULL; /* After gate vma */
198 +printk("%s:%i: \n", __FUNCTION__, __LINE__);
203 +printk("%s:%i: %p\n", __FUNCTION__, __LINE__, tail_vma);
205 + /* End of vmas has been reached */
206 + m->version = (tail_vma != NULL)? 0: -1UL;
207 + up_read(&mm->mmap_sem);
211 static void m_stop(struct seq_file *m, void *v)
213 + struct task_struct *task = m->private;
214 + struct vm_area_struct *vma = v;
215 +printk("!!! BOOYA %s\n", __FUNCTION__);
216 + if (vma && vma != get_gate_vma(task)) {
217 + struct mm_struct *mm = vma->vm_mm;
218 + up_read(&mm->mmap_sem);
222 static void *m_next(struct seq_file *m, void *v, loff_t *pos)
225 + struct task_struct *task = m->private;
226 + struct vm_area_struct *vma = v;
227 + struct vm_area_struct *tail_vma = get_gate_vma(task);
228 +printk("!!! BOOYA %s\n", __FUNCTION__);
231 + if (vma && (vma != tail_vma) && vma->vm_next)
232 + return vma->vm_next;
234 + return (vma != tail_vma)? tail_vma: NULL;
236 struct seq_operations proc_pid_maps_op = {