diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-11-30 17:37:04 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:44:29 -0500 |
commit | f8b7256096a20436f6d0926747e3ac3d64c81d24 (patch) | |
tree | 18bcabd1de263bd2d0f8d6b763bde8b037716c5c /arch/um | |
parent | 0067bd8a55862ac9dd212bd1c4f6f5bff1ca1301 (diff) |
Unify sys_mmap*
New helper - sys_mmap_pgoff(); switch syscalls to using it.
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/kernel/syscall.c | 28 | ||||
-rw-r--r-- | arch/um/sys-i386/shared/sysdep/syscalls.h | 4 |
2 files changed, 2 insertions, 30 deletions
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index a4625c7b2bf9..cccab850c27e 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "linux/mm.h" | 8 | #include "linux/mm.h" |
9 | #include "linux/sched.h" | 9 | #include "linux/sched.h" |
10 | #include "linux/utsname.h" | 10 | #include "linux/utsname.h" |
11 | #include "linux/syscalls.h" | ||
11 | #include "asm/current.h" | 12 | #include "asm/current.h" |
12 | #include "asm/mman.h" | 13 | #include "asm/mman.h" |
13 | #include "asm/uaccess.h" | 14 | #include "asm/uaccess.h" |
@@ -37,31 +38,6 @@ long sys_vfork(void) | |||
37 | return ret; | 38 | return ret; |
38 | } | 39 | } |
39 | 40 | ||
40 | /* common code for old and new mmaps */ | ||
41 | long sys_mmap2(unsigned long addr, unsigned long len, | ||
42 | unsigned long prot, unsigned long flags, | ||
43 | unsigned long fd, unsigned long pgoff) | ||
44 | { | ||
45 | long error = -EBADF; | ||
46 | struct file * file = NULL; | ||
47 | |||
48 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
49 | if (!(flags & MAP_ANONYMOUS)) { | ||
50 | file = fget(fd); | ||
51 | if (!file) | ||
52 | goto out; | ||
53 | } | ||
54 | |||
55 | down_write(¤t->mm->mmap_sem); | ||
56 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
57 | up_write(¤t->mm->mmap_sem); | ||
58 | |||
59 | if (file) | ||
60 | fput(file); | ||
61 | out: | ||
62 | return error; | ||
63 | } | ||
64 | |||
65 | long old_mmap(unsigned long addr, unsigned long len, | 41 | long old_mmap(unsigned long addr, unsigned long len, |
66 | unsigned long prot, unsigned long flags, | 42 | unsigned long prot, unsigned long flags, |
67 | unsigned long fd, unsigned long offset) | 43 | unsigned long fd, unsigned long offset) |
@@ -70,7 +46,7 @@ long old_mmap(unsigned long addr, unsigned long len, | |||
70 | if (offset & ~PAGE_MASK) | 46 | if (offset & ~PAGE_MASK) |
71 | goto out; | 47 | goto out; |
72 | 48 | ||
73 | err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 49 | err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); |
74 | out: | 50 | out: |
75 | return err; | 51 | return err; |
76 | } | 52 | } |
diff --git a/arch/um/sys-i386/shared/sysdep/syscalls.h b/arch/um/sys-i386/shared/sysdep/syscalls.h index 905698197e35..e7787679e317 100644 --- a/arch/um/sys-i386/shared/sysdep/syscalls.h +++ b/arch/um/sys-i386/shared/sysdep/syscalls.h | |||
@@ -20,7 +20,3 @@ extern syscall_handler_t *sys_call_table[]; | |||
20 | #define EXECUTE_SYSCALL(syscall, regs) \ | 20 | #define EXECUTE_SYSCALL(syscall, regs) \ |
21 | ((long (*)(struct syscall_args)) \ | 21 | ((long (*)(struct syscall_args)) \ |
22 | (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) | 22 | (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) |
23 | |||
24 | extern long sys_mmap2(unsigned long addr, unsigned long len, | ||
25 | unsigned long prot, unsigned long flags, | ||
26 | unsigned long fd, unsigned long pgoff); | ||