From: Simon Wright <simon@pushface.org>
Subject: Re: GNAT and Memory Maps?
Date: 05 Jul 2003 17:22:03 +0100
Date: 2003-07-05T17:22:03+01:00 [thread overview]
Message-ID: <x7vsmpl54gk.fsf@smaug.pushface.org> (raw)
In-Reply-To: pan.2003.07.05.03.42.01.638542.1720@nomail.com
Freejack <Freejack@nomail.com> writes:
> I've been picking through the GNAT docs (and Ada docs in general) in
> an attempt to figure out how/if and when/why the Ada compiler might
> choose to use an mmap system call in deference to a malloc/calloc or
> alloca call.
I would be very surprised if GNAT ever chose to use mmap -- how would
it know which file to map?
> Basically, I'm doing some low level routines and I need explicit
> control over what pages are swapped and when. ( mmap() mlock()
> munlock() and munmap() are the usual C functions for handling this.)
These functions are (C bindings to) system calls; so at some point
there is going to be a software interrupt (int-something on Intel). I
don't see what advantage you'll get by rewriting the C bindings?
> I'm using Linux at the moment, and I could just as easily use the
> native C library (glibc). However, I want to handle this entirely in
> Ada. I'm using the No_Run_Time Pragma.
I suspect you can still link against the C libraries with No_Run_Time.
Someone suggested use of a storage pool, but (a) I doubt that's
compatible with No_Run_Time, (b) storage pools are about supporting
multiple allocations, if you want to "mmap these 16#40000# bytes which
I will treat as a data structure like _that_" storage pools seem
irrelevant.
next prev parent reply other threads:[~2003-07-05 16:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-05 3:36 GNAT and Memory Maps? Freejack
2003-07-05 4:42 ` Freejack
2003-07-05 13:10 ` Ludovic Brenta
2003-07-05 23:24 ` Freejack
2003-07-08 1:40 ` John Kern
2003-07-08 8:20 ` Freejack
2003-07-08 14:56 ` Rod Chapman
2003-07-05 16:22 ` Simon Wright [this message]
2003-07-07 3:50 ` Hyman Rosen
2003-07-08 20:20 ` Simon Wright
2003-07-05 19:59 ` Florian Weimer
2003-07-07 7:44 ` Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox