From owner-freebsd-hackers Tue Dec 17 09:05:04 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id JAA06159 for hackers-outgoing; Tue, 17 Dec 1996 09:05:04 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id JAA06148 for ; Tue, 17 Dec 1996 09:05:01 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by who.cdrom.com (8.7.5/8.6.11) with SMTP id JAA27973 for ; Tue, 17 Dec 1996 09:04:46 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA08511; Tue, 17 Dec 1996 10:01:37 -0700 From: Terry Lambert Message-Id: <199612171701.KAA08511@phaeton.artisoft.com> Subject: Re: Almost have mmap() figured, I think... To: scrappy@hub.org (Marc G. Fournier) Date: Tue, 17 Dec 1996 10:01:37 -0700 (MST) Cc: terry@lambert.org, hackers@freebsd.org In-Reply-To: from "Marc G. Fournier" at Dec 16, 96 09:38:34 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > size = mmap( 0, sizeof(int) * FRAMES, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)); > for(i = 0; i < FRAMES; i++) > framesize[i] = start + i * sizeof(int); > > ? or: start = mmap( 0, (sizeof(int)+FRAMESIZE)*FRAMES, PROT_READ|PROT_WRITE,... for(i = 0; i < FRAMES; i++) { framesize[i] = start; start += sizeof(int); } for(i = 0; i < FRAMES; i++) { frame[i] = start; start += FRAMESIZE; } ...and again, use only one mapping. > > Also: Are you mapping in both the client and the server? Or just > > the server? > > Not quite sure what you mean here...client has: [ ... ] OK, you are mapping in both. I don't know if you are allowed to have PROT_READ|PROT_WRITE in one and only PROT_READ in the other; John Dyson would be the guy to ask... > I'm using "Advanced Programming in the Unix Environment" by > Stevens as my new "bible", and it states that "MAP_SHARED or MAP_PRIVATE > must be specified"...unfortunately, his only "example" happens to have > two different files MMAP'd, and then he's doing an memcpy() between > them :( Is the above incorrect? The Stevens book is the bible... but that example you might want to consider most relevent is in the cp code in /src/bin/cp/utils.c. John: there is still "#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED" in that code... is that right now? > Binary data, so this may be correct, since the "data" that I'm > getting on the opposite end is exactly the same as the data on the server > end... Hey, if it's working, don't fix it. Also: look in the -current list archive for the mmap() functionality testing code that was posted a while back... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.