diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 23fb033e596d..cbbc13774819 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -826,6 +826,11 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
826 | unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 826 | unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
827 | unsigned long vmpglen; | 827 | unsigned long vmpglen; |
828 | 828 | ||
829 | /* suppress VMA sharing for shared regions */ | ||
830 | if (vm_flags & VM_SHARED && | ||
831 | capabilities & BDI_CAP_MAP_DIRECT) | ||
832 | goto dont_share_VMAs; | ||
833 | |||
829 | for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) { | 834 | for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) { |
830 | vma = rb_entry(rb, struct vm_area_struct, vm_rb); | 835 | vma = rb_entry(rb, struct vm_area_struct, vm_rb); |
831 | 836 | ||
@@ -859,6 +864,7 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
859 | goto shared; | 864 | goto shared; |
860 | } | 865 | } |
861 | 866 | ||
867 | dont_share_VMAs: | ||
862 | vma = NULL; | 868 | vma = NULL; |
863 | 869 | ||
864 | /* obtain the address at which to make a shared mapping | 870 | /* obtain the address at which to make a shared mapping |
@@ -1193,6 +1199,28 @@ void unmap_mapping_range(struct address_space *mapping, | |||
1193 | EXPORT_SYMBOL(unmap_mapping_range); | 1199 | EXPORT_SYMBOL(unmap_mapping_range); |
1194 | 1200 | ||
1195 | /* | 1201 | /* |
1202 | * ask for an unmapped area at which to create a mapping on a file | ||
1203 | */ | ||
1204 | unsigned long get_unmapped_area(struct file *file, unsigned long addr, | ||
1205 | unsigned long len, unsigned long pgoff, | ||
1206 | unsigned long flags) | ||
1207 | { | ||
1208 | unsigned long (*get_area)(struct file *, unsigned long, unsigned long, | ||
1209 | unsigned long, unsigned long); | ||
1210 | |||
1211 | get_area = current->mm->get_unmapped_area; | ||
1212 | if (file && file->f_op && file->f_op->get_unmapped_area) | ||
1213 | get_area = file->f_op->get_unmapped_area; | ||
1214 | |||
1215 | if (!get_area) | ||
1216 | return -ENOSYS; | ||
1217 | |||
1218 | return get_area(file, addr, len, pgoff, flags); | ||
1219 | } | ||
1220 | |||
1221 | EXPORT_SYMBOL(get_unmapped_area); | ||
1222 | |||
1223 | /* | ||
1196 | * Check that a process has enough memory to allocate a new virtual | 1224 | * Check that a process has enough memory to allocate a new virtual |
1197 | * mapping. 0 means there is enough memory for the allocation to | 1225 | * mapping. 0 means there is enough memory for the allocation to |
1198 | * succeed and -ENOMEM implies there is not. | 1226 | * succeed and -ENOMEM implies there is not. |