From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,195cfda04e416f67 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-05 09:23:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GNAT and Memory Maps? Date: 05 Jul 2003 17:22:03 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1057422184 18490 62.49.19.209 (5 Jul 2003 16:23:04 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 5 Jul 2003 16:23:04 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:40079 Date: 2003-07-05T17:22:03+01:00 List-Id: Freejack 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.