aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mremap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-30 11:32:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-05-30 21:04:57 -0400
commit63a81db13205f21047a0799adfd3a2419f190577 (patch)
treecda25987d6e331cb026383f50e351bd9f5f66934 /mm/mremap.c
parent657bec850ff98b82b3a617b588a6523487344ccc (diff)
merge do_mremap() into sys_mremap()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r--mm/mremap.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index db8d983b5a7d..169c53b87749 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -432,15 +432,17 @@ static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
432 * MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise 432 * MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise
433 * This option implies MREMAP_MAYMOVE. 433 * This option implies MREMAP_MAYMOVE.
434 */ 434 */
435unsigned long do_mremap(unsigned long addr, 435SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
436 unsigned long old_len, unsigned long new_len, 436 unsigned long, new_len, unsigned long, flags,
437 unsigned long flags, unsigned long new_addr) 437 unsigned long, new_addr)
438{ 438{
439 struct mm_struct *mm = current->mm; 439 struct mm_struct *mm = current->mm;
440 struct vm_area_struct *vma; 440 struct vm_area_struct *vma;
441 unsigned long ret = -EINVAL; 441 unsigned long ret = -EINVAL;
442 unsigned long charged = 0; 442 unsigned long charged = 0;
443 443
444 down_write(&current->mm->mmap_sem);
445
444 if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE)) 446 if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE))
445 goto out; 447 goto out;
446 448
@@ -538,17 +540,6 @@ unsigned long do_mremap(unsigned long addr,
538out: 540out:
539 if (ret & ~PAGE_MASK) 541 if (ret & ~PAGE_MASK)
540 vm_unacct_memory(charged); 542 vm_unacct_memory(charged);
541 return ret;
542}
543
544SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
545 unsigned long, new_len, unsigned long, flags,
546 unsigned long, new_addr)
547{
548 unsigned long ret;
549
550 down_write(&current->mm->mmap_sem);
551 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
552 up_write(&current->mm->mmap_sem); 543 up_write(&current->mm->mmap_sem);
553 return ret; 544 return ret;
554} 545}