destroyed shm segments in 2.2

From: Christoph Rohland (cr@sap.com)
Date: Wed Oct 04 2000 - 07:51:49 EST


Hi Alan,

We just stumbled over the Linux 2.2 behaviour that you cannot create a
shm segment with a key of a destroyed segment. This breaks some
applications.

Could we change the behaviour in 2.2 like we did it in 2.3 and make it
more compatible with other UN*Xes? The attached (untested) patch
should implement the 2.4 behaviour.

Greetings
                Christoph


--- linux/ipc/shm.c.orig Wed Oct 4 14:23:08 2000
+++ linux/ipc/shm.c Wed Oct 4 14:25:24 2000
@@ -161,9 +161,7 @@
                 err = -EEXIST;
         } else {
                 shp = shm_segs[id];
- if (shp->u.shm_perm.mode & SHM_DEST)
- err = -EIDRM;
- else if (size > shp->u.shm_segsz)
+ if (size > shp->u.shm_segsz)
                         err = -EINVAL;
                 else if (ipcperms (&shp->u.shm_perm, shmflg))
                         err = -EACCES;
@@ -341,6 +339,7 @@
                     current->euid == shp->u.shm_perm.cuid ||
                     capable(CAP_SYS_ADMIN)) {
                         shp->u.shm_perm.mode |= SHM_DEST;
+ shp->u.shm_perm.key = IPC_PRIVATE;
                         if (shp->u.shm_nattch <= 0)
                                 killseg (id);
                         break;

-
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/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:13 EST