Date: Tue, 2 Mar 1999 09:43:09 -0500 (EST) From: Alfred Perlstein <bright@cygnus.rush.net> To: Peter Edwards <peter.edwards@isocor.ie> Cc: freebsd-hackers@FreeBSD.ORG, green@unixhelp.org Subject: Re: mmap on /dev/zero Message-ID: <Pine.BSF.3.96.990302094001.7848p-100000@cygnus.rush.net> In-Reply-To: <36DBE8B5.A612F447@isocor.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2 Mar 1999, Peter Edwards wrote: > Hi, > I seem to remember someone a while back suggesting that you could create > shared memory between processes using mmap on /dev/zero, and passing the > open descriptor to other processes (though I might be wrong). > As a result, I thought the following might allow child and parent to > share a mapped region: > > fd = open("/dev/zero", O_RDWR); > fork(); > p = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); > > A simple test indicated that the two mappings were seperate. (This was > on 2.2.8-RELEASE, if its of any consequence) > > Is this possible to do such sharing through /dev/zero, or do I need to > inherit the mapped region? I'd like to be able to dynamically expand the > shared regions without resorting to using a normal file for the mapping, > or resorting to SysV shared mem. > (If this has been thrashed to death already, sorry, but the -hackers and > -questions archives don't appear to be searchable at the moment) It has. :) You can not do this, you must inherit the shared segment or use SYSV. I do remeber someone trying some evil hack with /proc but i don't know if they were successful... were you Brian Feldman? :) -Alfred > > Cheers, > Peter. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990302094001.7848p-100000>