Re: mmap/madvise

2001-11-12 Thread Terry Lambert
Matthew Dillon wrote: He was writing a virtual memory manger of his own that resembled the Windows version of one he wrote, in order to port software to UNIX (most likely Linux and not FreeBSD, if you were to look at the web site for his company). > Simply using a pre-written file does not r

Re: mmap/madvise

2001-11-12 Thread Matthew Dillon
: :Matthew Dillon wrote: :>The small-temporary-file trick is simple: create a small temporary :>file, get a file descriptor to it, remove() the file, then ftruncate() :>the descriptor to the amount of space you need, mmap() it :>MAP_PRIVATE, and close the descriptor. Since it is

Re: mmap/madvise

2001-11-12 Thread Terry Lambert
Matthew Dillon wrote: >The small-temporary-file trick is simple: create a small temporary >file, get a file descriptor to it, remove() the file, then ftruncate() >the descriptor to the amount of space you need, mmap() it >MAP_PRIVATE, and close the descriptor. Since it is a privat

Re: mmap/madvise

2001-11-12 Thread Matthew Dillon
: : :The man pages state that the fd must be -1 for MAP_ANON. :an open() /dev/zero will return an valid file descriptor. So how would I :mmap using /dev/zero? : :> Too bad there isn't an "Advance UNIX programming for Windows :> Programmers" book. 8-(. : :Sounds like their could be a good market

Re: mmap/madvise

2001-11-09 Thread Terry Lambert
Jason Mawdsley wrote: > > > > I am creating a virtual memory manager. > > > > > > Currently I am doing a > > > mmap(...PROT_NONE, MAP_ANON ) to reserve the memory. > > > then when committing the memory I am using mprotect( ...PROT_READ | > > > PROT_WRITE ) > > > > mmap For reservation of memory;

Re: mmap/madvise

2001-11-09 Thread Jason Mawdsley
> > I am creating a virtual memory manager. > > > > Currently I am doing a > > mmap(...PROT_NONE, MAP_ANON ) to reserve the memory. > > then when committing the memory I am using mprotect( ...PROT_READ | > > PROT_WRITE ) > > mmap For reservation of memory; you should > mmap the fd for /dev/zero,

Re: mmap/madvise -- Thanks!

2001-11-09 Thread Jason Mawdsley
Wow! The responses to my question have been amazing! I never expected to get the wealth of information that you people have given me. Thank you all! Jason. Jason Mawdsley ~ [EMAIL PROTECTED] Software Designer ~ m_ a c a d a m i a nt e c h n o l o g i e s "Software developers for the wor

Re: mmap/madvise

2001-11-08 Thread Matthew Dillon
:I am creating a virtual memory manager. : :Currently I am doing a :mmap(...PROT_NONE, MAP_ANON ) to reserve the memory. :then when committing the memory I am using mprotect( ...PROT_READ | :PROT_WRITE ) : :HTH : :Jason Mawdsley ~ [EMAIL PROTECTED] :m_ a c a d a m i a nt e c h n o l o g i e s

Re: mmap/madvise

2001-11-08 Thread Terry Lambert
Jason Mawdsley wrote: > > > Jason Mawdsley <[EMAIL PROTECTED]> asks: > > > > > > I am looking for a way to reserve memory, without actually > > > > allocating the swap space. > > > > Alfred Perlstein answers: > > > > > Just proceed normally, freebsd does overcommit such that you really > > >