From owner-freebsd-hackers Tue Dec 10 10:25:13 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id KAA19638 for hackers-outgoing; Tue, 10 Dec 1996 10:25:13 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id KAA19633 for ; Tue, 10 Dec 1996 10:25:11 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA04496; Tue, 10 Dec 1996 11:03:26 -0700 From: Terry Lambert Message-Id: <199612101803.LAA04496@phaeton.artisoft.com> Subject: Re: Multiple Buffer allocation of Shared Memory To: scrappy@hub.org (Marc G. Fournier) Date: Tue, 10 Dec 1996 11:03:25 -0700 (MST) Cc: hackers@FreeBSD.ORG In-Reply-To: from "Marc G. Fournier" at Dec 9, 96 07:56:16 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 > that I don't know if its too be expected, or if I've screwed something > up... Administrative limit because of address space crowding... just like the limit on segment size. You can override as necessary, and rebuild a kernel. However, I would suggest you use mmap instead, if possible. > ---- > #define MAXMESGDATA 2048 > > typedef struct { > int mesg_len; > char mesg_data[MAXMESGDATA]; > } Mesg; > ---- WARNING! When you map a shared memory region or file into an address space, the cache unification and the x86 page protection mechanism forces the mapping to be in chunks of 4k. This basically means that you are overlapping your regions here. The first region, if it starts on a 4k boundry (which it will, according to your code) will map the first 4k page at the start address. The second will map 8k, since it spans a 4k boundry: the first 4k, followed by the next 4k. It will be mapped at a different address. And so on, based on crossing conditions of 4k boundries. It would be much better to mmap a contiguous area, where each message fills up exactly 4k (even if you need pad to do it) and make sure the messages are on 4k boundries to ensure seperate protection domains. This is true, even if you use SVR4 primitives... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.