mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Sorry to be annoying, but "PATCH for shmdt"
@ 2001-12-10 23:53 Andries.Brouwer
  0 siblings, 0 replies; 2+ messages in thread
From: Andries.Brouwer @ 2001-12-10 23:53 UTC (permalink / raw)
  To: bottchen, linux-kernel; +Cc: marcelo, torvalds

    From: <bottchen@earthlink.net>

        Unfortunately the patch I submitted for shmdt has been overlooked.
    It's not a very exciting patch, but it does bring the code into agreement
    with the manpage.  Here is an version of the patch updated for 2.4.16.

Yes, I agree. Referring to POSIX would have been more convincing,
but it is true that shmdt is supposed to return EINVAL when the
memory to be detached is not found.

Andries


    --- linux-2.4.16old/ipc/shm.c   Mon Dec  10 11:53:12 2001
    +++ linux-2.4.16/ipc/shm.c      Mon Dec  10 15:08:51 2001
    @@ -651,16 +651,19 @@
     {
            struct mm_struct *mm = current->mm;
            struct vm_area_struct *shmd, *shmdnext;
    +       int retcode = -EINVAL;

            down_write(&mm->mmap_sem);
            for (shmd = mm->mmap; shmd; shmd = shmdnext) {
                    shmdnext = shmd->vm_next;
                    if (shmd->vm_ops == &shm_vm_ops
    -                   && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr)
    +                   && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) {
                            do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start);
    +                       retcode = 0;
    +               }
            }
            up_write(&mm->mmap_sem);
    -       return 0;
    +       return retcode;
     }

     #ifdef CONFIG_PROC_FS


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Sorry to be annoying, but "PATCH for shmdt"
@ 2001-12-10 21:57 bottchen
  0 siblings, 0 replies; 2+ messages in thread
From: bottchen @ 2001-12-10 21:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

	Unfortunately the patch I submitted for shmdt has been overlooked.
It's not a very exciting patch, but it does bring the code into agreement
with the manpage.  Here is an version of the patch updated for 2.4.16.

--- linux-2.4.16old/ipc/shm.c   Mon Dec  10 11:53:12 2001
+++ linux-2.4.16/ipc/shm.c      Mon Dec  10 15:08:51 2001
@@ -651,16 +651,19 @@
 {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *shmd, *shmdnext;
+       int retcode=-EINVAL;

        down_write(&mm->mmap_sem);
        for (shmd = mm->mmap; shmd; shmd = shmdnext) {
                shmdnext = shmd->vm_next;
                if (shmd->vm_ops == &shm_vm_ops
-                   && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) ==
(ulong) shmaddr)
+                   && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) ==
(ulong) shmaddr) {
                        do_munmap(mm, shmd->vm_start, shmd->vm_end -
shmd->vm_start);
+                       retcode=0;
+               }
        }
        up_write(&mm->mmap_sem);
-       return 0;
+       return retcode;
 }

 #ifdef CONFIG_PROC_FS



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-10 23:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-10 23:53 Sorry to be annoying, but "PATCH for shmdt" Andries.Brouwer
  -- strict thread matches above, loose matches on Subject: below --
2001-12-10 21:57 bottchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®