mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
Add generic sys_old_mmap()
Add a generic implementation of the old mmap() syscall, which expects its argument in a memory block and switch all architectures over to use it. Signed-off-by: Christoph Hellwig <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mundt <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Hirokazu Takata <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Cc: Al Viro <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: James Morris <[email protected]> Cc: Andreas Schwab <[email protected]> Acked-by: Jesper Nilsson <[email protected]> Acked-by: Russell King <[email protected]> Acked-by: Greg Ungerer <[email protected]> Acked-by: David Howells <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5d0e52830e
commit
a4679373cf
31 changed files with 79 additions and 258 deletions
24
mm/mmap.c
24
mm/mmap.c
|
|
@ -1088,6 +1088,30 @@ out:
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef __ARCH_WANT_SYS_OLD_MMAP
|
||||
struct mmap_arg_struct {
|
||||
unsigned long addr;
|
||||
unsigned long len;
|
||||
unsigned long prot;
|
||||
unsigned long flags;
|
||||
unsigned long fd;
|
||||
unsigned long offset;
|
||||
};
|
||||
|
||||
SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
|
||||
{
|
||||
struct mmap_arg_struct a;
|
||||
|
||||
if (copy_from_user(&a, arg, sizeof(a)))
|
||||
return -EFAULT;
|
||||
if (a.offset & ~PAGE_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
|
||||
a.offset >> PAGE_SHIFT);
|
||||
}
|
||||
#endif /* __ARCH_WANT_SYS_OLD_MMAP */
|
||||
|
||||
/*
|
||||
* Some shared mappigns will want the pages marked read-only
|
||||
* to track write events. If so, we'll downgrade vm_page_prot
|
||||
|
|
|
|||
24
mm/nommu.c
24
mm/nommu.c
|
|
@ -1428,6 +1428,30 @@ out:
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef __ARCH_WANT_SYS_OLD_MMAP
|
||||
struct mmap_arg_struct {
|
||||
unsigned long addr;
|
||||
unsigned long len;
|
||||
unsigned long prot;
|
||||
unsigned long flags;
|
||||
unsigned long fd;
|
||||
unsigned long offset;
|
||||
};
|
||||
|
||||
SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
|
||||
{
|
||||
struct mmap_arg_struct a;
|
||||
|
||||
if (copy_from_user(&a, arg, sizeof(a)))
|
||||
return -EFAULT;
|
||||
if (a.offset & ~PAGE_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
|
||||
a.offset >> PAGE_SHIFT);
|
||||
}
|
||||
#endif /* __ARCH_WANT_SYS_OLD_MMAP */
|
||||
|
||||
/*
|
||||
* split a vma into two pieces at address 'addr', a new vma is allocated either
|
||||
* for the first part or the tail.
|
||||
|
|
|
|||
Loading…
Reference in a new issue