From: Adam Bottchen <bottchen@earthlink.net>
To: linux-kernel@vger.kernel.org
Cc: torvalds@transmeta.com
Subject: Patch to sys_shmdt
Date: Thu, 11 Oct 2001 15:20:06 -0500 [thread overview]
Message-ID: <01101115200601.24484@scully> (raw)
Currently sys_shmdt() always returns success. Below is a patch that changes
this behavior to match the man page. This patch will cause sys_shmdt() to
return success only when it finds something to detach, and returns EINVAL
otherwise. The patch was run on a 2.4.10 kernel tree, but applies against a 2.4.12
tree with no problems.
--- linux-2.4.10old/ipc/shm.c Fri Oct 5 11:53:12 2001
+++ linux-2.4.10/ipc/shm.c Fri Oct 5 15:08:51 2001
@@ -649,16 +649,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
Adam Bottchen
bottchen@earthlink.net
reply other threads:[~2001-10-11 20:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01101115200601.24484@scully \
--to=bottchen@earthlink.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox