]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] error code for msync()
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>
Sun, 14 Jul 2002 11:10:38 +0000 (04:10 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 14 Jul 2002 11:10:38 +0000 (04:10 -0700)
SuSv3 says: "The msync() function shall fail if:

[EBUSY]
    Some or all of the addresses in the range starting at addr and
    continuing for len bytes are locked, and MS_INVALIDATE is
    specified.

[EINVAL]
    The value of flags is invalid.

[EINVAL]
    The value of addr is not a multiple of the page size {PAGESIZE}.

[ENOMEM]
    The addresses in the range starting at addr and continuing for len
    bytes are outside the range allowed for the address space of a process
    or specify one or more pages that are not mapped."

This fixes error code of msync() of the EINVAL case.

mm/msync.c

index 5ea980e6b1dc42b3774a9c508db0239328297da4..7eb28dab203b5092ade18fdfd99b59146b911f63 100644 (file)
@@ -169,17 +169,18 @@ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
 {
        unsigned long end;
        struct vm_area_struct * vma;
-       int unmapped_error, error = -ENOMEM;
+       int unmapped_error, error = -EINVAL;
 
        down_read(&current->mm->mmap_sem);
+       if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
+               goto out;
        if (start & ~PAGE_MASK)
                goto out;
+       error = -ENOMEM;
        len = (len + ~PAGE_MASK) & PAGE_MASK;
        end = start + len;
        if (end < start)
                goto out;
-       if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
-               goto out;
        error = 0;
        if (end == start)
                goto out;