Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.os.linux.development.apps Subject: Re: mmap for IPC Date: Thu, 02 May 2013 14:42:44 +0100 Lines: 19 Message-ID: <87ppx933cb.fsf@sapphire.mobileactivedefense.com> References: <5b2c726f-7805-401e-8c42-9407adf6ce9f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net sbpe67xjQpOrF+1qZt07xgdwyGuk1BsLiR1sWpJEVMSyDBths= Cancel-Lock: sha1:axhdhFXEEYb/C/10jhC2GvqYG6M= sha1:U+Q00kS/lVI81ZPaf6f+OWl6wt8= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Xref: csiph.com comp.os.linux.development.apps:589 Lusotec writes: > Jay Braun wrote: >> Just want to make sure: If I use mmap for inter-process communication, >> the processes that share the memory need not be forked from some parent >> process. They can be invoked independently, correct? > > Yes, if the mapping is not anonymous. If the mapping is anonymous only the > process and its children can access the anonymous mapping (see MAP_ANONYMOUS > in man mmap). > > On a side note, you may want to use shm_open instead of mmap directly if you > want to use shared memory for IPC between unrelated processes. Quoting shm_open(3): A POSIX shared memory object is in effect a handle which can be used by unrelated processes to mmap(2) the same region of shared memory.