blob: ed9f34da1a2a49f4fb86c6cf68f373c2d7e99af7 [file] [log] [blame]
Michal Simek7dcbbb22009-03-27 14:25:28 +01001/*
2 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2007-2009 PetaLogix
4 * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
5 *
6 * Copyright (C) 2006 Atmark Techno, Inc.
7 * Yasushi SHOJI <yashi@atmark-techno.com>
8 * Tetsuya OHKAWA <tetsuya@atmark-techno.com>
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15#include <linux/errno.h>
Michal Simekd64af912013-02-01 13:10:35 +010016#include <linux/export.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010017#include <linux/mm.h>
18#include <linux/smp.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010019#include <linux/syscalls.h>
20#include <linux/sem.h>
21#include <linux/msg.h>
22#include <linux/shm.h>
23#include <linux/stat.h>
24#include <linux/mman.h>
25#include <linux/sys.h>
26#include <linux/ipc.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010027#include <linux/file.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010028#include <linux/err.h>
29#include <linux/fs.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010030#include <linux/semaphore.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010031#include <linux/uaccess.h>
32#include <linux/unistd.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090033#include <linux/slab.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010034#include <asm/syscalls.h>
Michal Simek7dcbbb22009-03-27 14:25:28 +010035
Michal Simek176195e2013-09-16 07:45:29 +020036SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
37 unsigned long, prot, unsigned long, flags, unsigned long, fd,
38 off_t, pgoff)
Michal Simek7dcbbb22009-03-27 14:25:28 +010039{
Al Virof8b72562009-11-30 17:37:04 -050040 if (pgoff & ~PAGE_MASK)
41 return -EINVAL;
Michal Simek7dcbbb22009-03-27 14:25:28 +010042
Dominik Brodowskia90f5902018-03-11 11:34:46 +010043 return ksys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
Michal Simek7dcbbb22009-03-27 14:25:28 +010044}
Michal Simek99399542013-09-16 07:46:23 +020045
46SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
47 unsigned long, prot, unsigned long, flags, unsigned long, fd,
48 unsigned long, pgoff)
49{
50 if (pgoff & (~PAGE_MASK >> 12))
51 return -EINVAL;
52
Dominik Brodowskia90f5902018-03-11 11:34:46 +010053 return ksys_mmap_pgoff(addr, len, prot, flags, fd,
54 pgoff >> (PAGE_SHIFT - 12));
Michal Simek99399542013-09-16 07:46:23 +020055}