From owner-freebsd-hackers Tue Mar 2 15: 5:35 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (Postfix) with ESMTP id CF87D1522E for ; Tue, 2 Mar 1999 15:05:12 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id SAA08533; Tue, 2 Mar 1999 18:04:38 -0500 (EST) Date: Tue, 2 Mar 1999 18:04:38 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: Alfred Perlstein Cc: Peter Edwards , freebsd-hackers@FreeBSD.ORG Subject: Re: mmap on /dev/zero In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 2 Mar 1999, Alfred Perlstein wrote: > > > 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? :) Me? I was just mmaping in parts of /proc/foopid/mem =) > > -Alfred > > > > > > Cheers, > > Peter. > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-hackers" in the body of the message > > > > Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message