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/x86/ia32 | |
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/x86/ia32')
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 2 | ||||
-rw-r--r-- | arch/x86/ia32/sys_ia32.c | 43 |
2 files changed, 2 insertions, 43 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 4eefdca9832b..53147ad85b96 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -696,7 +696,7 @@ ia32_sys_call_table: | |||
696 | .quad quiet_ni_syscall /* streams2 */ | 696 | .quad quiet_ni_syscall /* streams2 */ |
697 | .quad stub32_vfork /* 190 */ | 697 | .quad stub32_vfork /* 190 */ |
698 | .quad compat_sys_getrlimit | 698 | .quad compat_sys_getrlimit |
699 | .quad sys32_mmap2 | 699 | .quad sys_mmap_pgoff |
700 | .quad sys32_truncate64 | 700 | .quad sys32_truncate64 |
701 | .quad sys32_ftruncate64 | 701 | .quad sys32_ftruncate64 |
702 | .quad sys32_stat64 /* 195 */ | 702 | .quad sys32_stat64 /* 195 */ |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index df82c0e48ded..422572c77923 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
@@ -155,9 +155,6 @@ struct mmap_arg_struct { | |||
155 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | 155 | asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) |
156 | { | 156 | { |
157 | struct mmap_arg_struct a; | 157 | struct mmap_arg_struct a; |
158 | struct file *file = NULL; | ||
159 | unsigned long retval; | ||
160 | struct mm_struct *mm ; | ||
161 | 158 | ||
162 | if (copy_from_user(&a, arg, sizeof(a))) | 159 | if (copy_from_user(&a, arg, sizeof(a))) |
163 | return -EFAULT; | 160 | return -EFAULT; |
@@ -165,22 +162,8 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | |||
165 | if (a.offset & ~PAGE_MASK) | 162 | if (a.offset & ~PAGE_MASK) |
166 | return -EINVAL; | 163 | return -EINVAL; |
167 | 164 | ||
168 | if (!(a.flags & MAP_ANONYMOUS)) { | 165 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
169 | file = fget(a.fd); | ||
170 | if (!file) | ||
171 | return -EBADF; | ||
172 | } | ||
173 | |||
174 | mm = current->mm; | ||
175 | down_write(&mm->mmap_sem); | ||
176 | retval = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, | ||
177 | a.offset>>PAGE_SHIFT); | 166 | a.offset>>PAGE_SHIFT); |
178 | if (file) | ||
179 | fput(file); | ||
180 | |||
181 | up_write(&mm->mmap_sem); | ||
182 | |||
183 | return retval; | ||
184 | } | 167 | } |
185 | 168 | ||
186 | asmlinkage long sys32_mprotect(unsigned long start, size_t len, | 169 | asmlinkage long sys32_mprotect(unsigned long start, size_t len, |
@@ -483,30 +466,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, | |||
483 | return ret; | 466 | return ret; |
484 | } | 467 | } |
485 | 468 | ||
486 | asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, | ||
487 | unsigned long prot, unsigned long flags, | ||
488 | unsigned long fd, unsigned long pgoff) | ||
489 | { | ||
490 | struct mm_struct *mm = current->mm; | ||
491 | unsigned long error; | ||
492 | struct file *file = NULL; | ||
493 | |||
494 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
495 | if (!(flags & MAP_ANONYMOUS)) { | ||
496 | file = fget(fd); | ||
497 | if (!file) | ||
498 | return -EBADF; | ||
499 | } | ||
500 | |||
501 | down_write(&mm->mmap_sem); | ||
502 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
503 | up_write(&mm->mmap_sem); | ||
504 | |||
505 | if (file) | ||
506 | fput(file); | ||
507 | return error; | ||
508 | } | ||
509 | |||
510 | asmlinkage long sys32_olduname(struct oldold_utsname __user *name) | 469 | asmlinkage long sys32_olduname(struct oldold_utsname __user *name) |
511 | { | 470 | { |
512 | char *arch = "x86_64"; | 471 | char *arch = "x86_64"; |