From owner-freebsd-hackers Tue Mar 2 5:35:27 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from penrose.isocor.ie (penrose.isocor.ie [194.106.155.117]) by hub.freebsd.org (Postfix) with ESMTP id 07CFC14BF6 for ; Tue, 2 Mar 1999 05:35:22 -0800 (PST) (envelope-from peter.edwards@isocor.ie) Received: from isocor.ie (194.106.155.218) by penrose.isocor.ie; 2 Mar 1999 13:35:17 +0000 Message-ID: <36DBE8B5.A612F447@isocor.ie> Date: Tue, 02 Mar 1999 13:33:41 +0000 From: Peter Edwards Organization: ISOCOR X-Mailer: Mozilla 4.5 [en] (X11; I; SunOS 5.6 i86pc) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: mmap on /dev/zero Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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) Cheers, Peter. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message