[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Controlling allocation in 64-bit space



Le Fri, Mar 24, 2006 at 04:24:46PM +0800, Davyd Madeley écrivait/wrote:
> Quoting Goswin von Brederlow <brederlo@informatik.uni-tuebingen.de>:
> 
> >mmap /dev/zero, that way you can pick the address you want.


I suggest more precisely to 
   mmap((void*)0, (size_t)size, PROT_READ|PROT_WRITE, 
        MAP_PRIVATE|MAP_ANONYMOUS, (int)-1 /*no fd*/, (off_t)0)

with MAP_ANONYMOUS you don't need to open /dev/zero (but internally it is
the same)

Regards

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France



Reply to: