text_combined: marcus hollandmoritz obslflxgmxnet 20071008 115010 0000 hmerijn brand wrote mon 8 oct 2007 113531 0200 marcus hollandmoritz wrote 20070925 160105 0200 rafael garciasuarez wrote however given new functionality heavily system dependent ooooh true attempt add shmat shmdt made perfect sense worked flawlessly linux got failures bsd reason im following make sure global shared memory cleaned automatically last attached process exits create shared memory segment shmget attach shmat remove immediately attaching shmctl ipc_rmid access using shmread shmwrite problem calls shmreadshmwrite attach detach shared memory segment invokation valid historical reasons seems linux case ipc_rmid simply remove file svid states block remains last person detaches deleted shmat rmid segment legal older linux change apps break bsd code openbsd 41 struct shmid_ds shm_find_segment_by_shmidint shmid int segnum struct shmid_ds shmseg segnum ipcid_to_ixshmid segnum 0 segnum shminfoshmmni shmseg shmsegssegnum null shmsegshm_permseq ipcid_to_seqshmid return null shmsegshm_permmode shmseg_removedshmseg_rmlinger shmseg_removed return null return shmseg case ipc_rmid error ipcpermcred shmsegshm_perm ipc_m 0 return error shmsegshm_permkey ipc_private shmsegshm_permmode shmseg_removed since still like idea backwardscompatible solution comes mind add two functions ipcsysv allow reading writing memory interface similar shmread shmwrite address instead shmid processes reason call two functions memread memwrite instead likely candidates shmread shmwrite correct used readwriting shared memory actually used arbitrary memory also dangerous use functions dont check anything process may already detached shared memory youre still able access functions could attach shared memory segment marked removal could still access shared memory shmat would return address format packp shmdt new functions called memread memwrite would take address allow also read memory using unpackp hopefully make little heavier misuse functions heres little example use ipcsysv qwshmat shmdt memread memwrite shm shmgetipc_private 4 s_irwxu addr shmatshm 0 0 shmctlshm ipc_rmid 0 memwriteaddr packn 0xbadc0de5 0 4 memreadaddr bytes 0 4 var unpack n bytes var unpack n unpack p4 addr shmdtaddr id like receive feedback anyone thinks really bad idea otherwise probably go cpan release looks promising thanks index n alphabetical list words possible interest alphabetical list subjects references ought wed 06 aug 2008 032944 0200 reading writing removed shared memory segments patch add shmat shmdt ipcsysv