Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2000 15:43:10 +0000 (GMT)
From:      Aled Morris <aledm@qix.co.uk>
To:        "G. Adam Stanislav" <adam@whizkidtech.net>
Cc:        Stephen McKay <mckay@thehub.com.au>, hackers@FreeBSD.ORG
Subject:   Re: pipe
Message-ID:  <Pine.BSF.4.21.0012051535400.618-100000@kai.qix.co.uk>
In-Reply-To: <20001205085645.A228@whizkidtech.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0012051535400.618-100000>