lkml.org 
[lkml]   [2000]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subjectdestroyed shm segments in 2.2
From
Date
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;
\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.219 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site