linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org, Dave Gilbert <gilbertd@treblig.org>
Subject: [Patch] shmmin behaviour back to 2.2 behaviour
Date: 27 Dec 2000 11:32:41 +0100	[thread overview]
Message-ID: <m3d7eeb1pa.fsf@linux.local> (raw)

Hi Linus,

The following patchlet bring the handling of shmget with size zero
back to the 2.2 behaviour. There seem to be programs out, which
(erroneously) rely on this.

Greetings
                Christoph

diff -uNr c/include/linux/shm.h c1/include/linux/shm.h
--- c/include/linux/shm.h	Fri Dec 22 10:20:08 2000
+++ c1/include/linux/shm.h	Tue Dec 26 19:52:15 2000
@@ -10,7 +10,7 @@
  */
 
 #define SHMMAX 0x2000000		 /* max shared seg size (bytes) */
-#define SHMMIN 0			 /* min shared seg size (bytes) */
+#define SHMMIN 1			 /* min shared seg size (bytes) */
 #define SHMMNI 4096			 /* max num of segs system wide */
 #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
 #define SHMSEG SHMMNI			 /* max shared segs per process */
diff -uNr c/ipc/shm.c c1/ipc/shm.c
--- c/ipc/shm.c	Fri Dec 22 10:05:38 2000
+++ c1/ipc/shm.c	Tue Dec 26 19:53:35 2000
@@ -179,6 +179,9 @@
 	char name[13];
 	int id;
 
+	if (size < SHMMIN || size > shm_ctlmax)
+		return -EINVAL;
+
 	if (shm_tot + numpages >= shm_ctlall)
 		return -ENOSPC;
 
@@ -222,9 +225,6 @@
 {
 	struct shmid_kernel *shp;
 	int err, id = 0;
-
-	if (size < SHMMIN || size > shm_ctlmax)
-		return -EINVAL;
 
 	down(&shm_ids.sem);
 	if (key == IPC_PRIVATE) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

             reply	other threads:[~2000-12-27 11:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-27 10:32 Christoph Rohland [this message]
2000-12-27 11:58 ` [Patch] shmmin behaviour back to 2.2 behaviour Dave Gilbert
2000-12-27 15:37   ` Christoph Rohland
2000-12-27 15:16 ` Marcelo Tosatti
2000-12-27 17:54   ` Christoph Rohland
2000-12-27 20:57   ` Andries Brouwer
2000-12-28 12:01     ` Christoph Rohland
2000-12-28 13:34       ` Andries Brouwer
2000-12-28 15:49         ` Alan Cox
2000-12-28 22:13           ` Christoph Rohland
2000-12-28 22:19             ` Alan Cox

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=m3d7eeb1pa.fsf@linux.local \
    --to=cr@sap.com \
    --cc=gilbertd@treblig.org \
    --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;
as well as URLs for NNTP newsgroup(s).