public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] shmmin behaviour back to 2.2 behaviour
@ 2000-12-27 10:32 Christoph Rohland
  2000-12-27 11:58 ` Dave Gilbert
  2000-12-27 15:16 ` Marcelo Tosatti
  0 siblings, 2 replies; 11+ messages in thread
From: Christoph Rohland @ 2000-12-27 10:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Dave Gilbert

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/

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

end of thread, other threads:[~2000-12-28 22:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-27 10:32 [Patch] shmmin behaviour back to 2.2 behaviour Christoph Rohland
2000-12-27 11:58 ` 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

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