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;