Subject: 2 processes accessing same memory?
To: 'netbsd-help@netbsd.org' <netbsd-help@netbsd.org>
From: Bruce Martin <BruceM@cat.co.za>
List: netbsd-help
Date: 04/09/1999 10:59:15
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------ =_NextPart_001_01BE8267.3ECFE560
Content-Type: text/plain

Hi all,

I am writing two processes: the first one puts something in
memory, and passes the memory address to the second one. The
second one must retrieve the info from this address and
store it on disk. I have created the memory needed in the
first process using mmap(), which gives me a pointer, but
when the second on reads from this address, it reads totally
different info than was put there by the first process.

I used:
	mmap((void
*)0,65536,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);
in the first process.

Any other commands I have to use to make sure that both
processes can access the same stuff from the same memory
address?

Thanks
  Bruce

------ =_NextPart_001_01BE8267.3ECFE560
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.0.1460.9">
<TITLE>2 processes accessing same memory?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hi all,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I am writing two processes: the first =
one puts something in memory, and passes the memory address to the =
second one. The second one must retrieve the info from this address and =
store it on disk. I have created the memory needed in the first process =
using mmap(), which gives me a pointer, but when the second on reads =
from this address, it reads totally different info than was put there =
by the first process.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I used:</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2 =
FACE=3D"Arial">mmap((void =
*)0,65536,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0);&nbsp; in the =
first process.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Any other commands I have to use to =
make sure that both processes can access the same stuff from the same =
memory address?</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Thanks</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; Bruce</FONT>
</P>

</BODY>
</HTML>
------ =_NextPart_001_01BE8267.3ECFE560--