diff options
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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 | } |
269 | EXPORT_SYMBOL_GPL(get_user_pages_fast); | 273 | EXPORT_SYMBOL_GPL(get_user_pages_fast); |
270 | 274 | ||
275 | SYSCALL_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(¤t->mm->mmap_sem); | ||
291 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
292 | up_write(¤t->mm->mmap_sem); | ||
293 | |||
294 | if (file) | ||
295 | fput(file); | ||
296 | out: | ||
297 | return retval; | ||
298 | } | ||
299 | |||
271 | /* Tracepoints definitions. */ | 300 | /* Tracepoints definitions. */ |
272 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); | 301 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); |
273 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); | 302 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); |