1 --- linux-2.6.x/mm/nommu.c
2 +++ linux-2.6.x/mm/nommu.c
3 @@ -421,6 +421,10 @@ static int validate_mmap_request(struct
4 if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
7 + /* Too many mappings? */
8 + if (current->mm->map_count > sysctl_max_map_count)
12 /* validate file mapping requests */
13 struct address_space *mapping;
14 @@ -853,6 +857,7 @@ unsigned long do_mmap_pgoff(struct file
16 vml->next = current->mm->context.vmlist;
17 current->mm->context.vmlist = vml;
18 + current->mm->map_count++;
20 up_write(&nommu_vma_sem);
22 @@ -961,6 +966,7 @@ int do_munmap(struct mm_struct *mm, unsi
24 update_hiwater_vm(mm);
25 mm->total_vm -= len >> PAGE_SHIFT;
29 show_process_blocks();
30 --- linux-2.6.x/fs/proc/task_nommu.c
31 +++ linux-2.6.x/fs/proc/task_nommu.c
32 @@ -137,23 +137,129 @@ out:
37 - * Albert D. Cahalan suggested to fake entries for the traditional
38 - * sections here. This might be worth investigating.
40 +static void pad_len_spaces(struct seq_file *m, int len)
42 + len = 25 + sizeof(void*) * 6 - len;
45 + seq_printf(m, "%*c", len, ' ');
48 static int show_map(struct seq_file *m, void *v)
50 + struct vm_list_struct *vml = v;
51 + struct vm_area_struct *vma = vml->vma;
52 + struct task_struct *task = m->private;
53 + struct mm_struct *mm = get_task_mm(task);
54 + struct file *file = vma->vm_file;
55 + int flags = vma->vm_flags;
56 + unsigned long ino = 0;
61 + struct inode *inode = vma->vm_file->f_dentry->d_inode;
62 + dev = inode->i_sb->s_dev;
66 + seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n",
69 + flags & VM_READ ? 'r' : '-',
70 + flags & VM_WRITE ? 'w' : '-',
71 + flags & VM_EXEC ? 'x' : '-',
72 + flags & VM_MAYSHARE ? 's' : 'p',
73 + vma->vm_pgoff << PAGE_SHIFT,
74 + MAJOR(dev), MINOR(dev), ino, &len);
77 + * Print the dentry name for named mappings, and a
78 + * special [heap] marker for the heap:
81 + pad_len_spaces(m, len);
82 + seq_path(m, file->f_vfsmnt, file->f_dentry, "\n");
85 + if (vma->vm_start <= mm->start_brk &&
86 + vma->vm_end >= mm->brk) {
87 + pad_len_spaces(m, len);
88 + seq_puts(m, "[heap]");
90 + if (vma->vm_start <= mm->start_stack &&
91 + vma->vm_end >= mm->start_stack) {
93 + pad_len_spaces(m, len);
94 + seq_puts(m, "[stack]");
98 + pad_len_spaces(m, len);
99 + seq_puts(m, "[vdso]");
106 static void *m_start(struct seq_file *m, loff_t *pos)
108 + struct task_struct *task = m->private;
109 + struct mm_struct *mm;
110 + struct vm_list_struct *vml;
113 + mm = get_task_mm(task);
117 + down_read(&mm->mmap_sem);
120 + * Check the vml index is within the range and do
121 + * sequential scan until m_index.
124 + if ((unsigned long)l < mm->map_count) {
125 + vml = mm->context.vmlist;
133 + /* End of vmls has been reached */
134 + up_read(&mm->mmap_sem);
139 static void m_stop(struct seq_file *m, void *v)
141 + struct task_struct *task = m->private;
142 + struct mm_struct *mm;
147 + mm = get_task_mm(task);
151 + up_read(&mm->mmap_sem);
154 static void *m_next(struct seq_file *m, void *v, loff_t *pos)
156 + struct vm_list_struct *vml = v;
159 + if (vml && vml->next)
165 struct seq_operations proc_pid_maps_op = {