From: David Howells Date: Thu, 22 Mar 2007 08:11:23 +0000 (-0800) Subject: [PATCH] NOMMU: supply get_unmapped_area() to fix NOMMU SYSV SHM X-Git-Tag: v2.6.21-rc5~38 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d56e03cd275486eb8141116a7af2df7457cb0115;p=linux-2.6 [PATCH] NOMMU: supply get_unmapped_area() to fix NOMMU SYSV SHM Supply a get_unmapped_area() to fix NOMMU SYSV SHM support. Signed-off-by: David Howells Acked-by: Adam Litke Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/nommu.c b/mm/nommu.c index 23fb033e59..ba6df4d299 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1192,6 +1192,28 @@ void unmap_mapping_range(struct address_space *mapping, } EXPORT_SYMBOL(unmap_mapping_range); +/* + * ask for an unmapped area at which to create a mapping on a file + */ +unsigned long get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + unsigned long (*get_area)(struct file *, unsigned long, unsigned long, + unsigned long, unsigned long); + + get_area = current->mm->get_unmapped_area; + if (file && file->f_op && file->f_op->get_unmapped_area) + get_area = file->f_op->get_unmapped_area; + + if (!get_area) + return -ENOSYS; + + return get_area(file, addr, len, pgoff, flags); +} + +EXPORT_SYMBOL(get_unmapped_area); + /* * Check that a process has enough memory to allocate a new virtual * mapping. 0 means there is enough memory for the allocation to