aboutsummaryrefslogtreecommitdiffstats
path: root/mm/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c
index 7c35ad95f927..3bf81b294ae8 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -4,6 +4,10 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/hugetlb.h>
8#include <linux/syscalls.h>
9#include <linux/mman.h>
10#include <linux/file.h>
7#include <asm/uaccess.h> 11#include <asm/uaccess.h>
8 12
9#define CREATE_TRACE_POINTS 13#define CREATE_TRACE_POINTS
@@ -268,6 +272,31 @@ int __attribute__((weak)) get_user_pages_fast(unsigned long start,
268} 272}
269EXPORT_SYMBOL_GPL(get_user_pages_fast); 273EXPORT_SYMBOL_GPL(get_user_pages_fast);
270 274
275SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
276 unsigned long, prot, unsigned long, flags,
277 unsigned long, fd, unsigned long, pgoff)
278{
279 struct file * file = NULL;
280 unsigned long retval = -EBADF;
281
282 if (!(flags & MAP_ANONYMOUS)) {
283 file = fget(fd);
284 if (!file)
285 goto out;
286 }
287
288 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
289
290 down_write(&current->mm->mmap_sem);
291 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
292 up_write(&current->mm->mmap_sem);
293
294 if (file)
295 fput(file);
296out:
297 return retval;
298}
299
271/* Tracepoints definitions. */ 300/* Tracepoints definitions. */
272EXPORT_TRACEPOINT_SYMBOL(kmalloc); 301EXPORT_TRACEPOINT_SYMBOL(kmalloc);
273EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); 302EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc);