From owner-freebsd-hackers Tue Dec 5 7:43:32 2000 From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 5 07:43:30 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from kai.qix.co.uk (kai.qix.co.uk [195.149.39.121]) by hub.freebsd.org (Postfix) with ESMTP id B459C37B400 for ; Tue, 5 Dec 2000 07:43:29 -0800 (PST) Received: from localhost (aledm@localhost) by kai.qix.co.uk (8.9.3/8.9.3) with ESMTP id PAA01022; Tue, 5 Dec 2000 15:43:10 GMT (envelope-from aledm@qix.co.uk) Date: Tue, 5 Dec 2000 15:43:10 +0000 (GMT) From: Aled Morris To: "G. Adam Stanislav" Cc: Stephen McKay , hackers@FreeBSD.ORG Subject: Re: pipe In-Reply-To: <20001205085645.A228@whizkidtech.net> 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, 5 Dec 2000, G. Adam Stanislav wrote: >> Use malloc() instead. > >Unfortunately, that only works in C. :) > >I tried to figure out how to allocate memory, but, so far, was completely >unsuccessful. malloc appears to mmap pages from fd -1, and makes them private and read/write (except on sparc architecture, where it uses /dev/zero rather than -1, which makes more sense to me) It isn't particularly complicated: newmem = mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); Aled To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message