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-Thread: 103376,7e32386ac8078f13 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "Adrian Hoe" Newsgroups: comp.lang.ada Subject: Re: POSIX.Memory_Mapping.Map_Memory Date: 29 Jan 2005 18:45:59 -0800 Organization: http://groups.google.com Message-ID: <1107053159.644479.173850@z14g2000cwz.googlegroups.com> References: <1107014307.952357.216870@f14g2000cwb.googlegroups.com> <1107016260.265640.138990@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 219.95.187.180 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1107053163 13982 127.0.0.1 (30 Jan 2005 02:46:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 30 Jan 2005 02:46:03 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=219.95.187.180; posting-account=LKUaWwwAAABzCo8SD2jIIt5LtkPzH8ot Xref: g2news1.google.com comp.lang.ada:8074 Date: 2005-01-29T18:45:59-08:00 List-Id: Mark Lorenzen wrote: > > In the way you are using Map_Memeory, it is probably because the value > of Offset (i.e. 0) is not page aligned. > > On many implementations, you can only map a multiple of the page size > and the memory has to be page aligned. > I wrote a short C program to test mmap. It works and seems like no problem doing mmap. The C code is as below: --------------------------------------------------------------------- #include #include #include "linux/ioctl.h" #include "sys/ioctl.h" #include "sys/mman.h" int main () { int fd; int bufsize; int result; char *buf; fd = open ("/dev/video0", O_RDWR); if (fd < 0) { printf ("Error open device.\n"); exit (1); } bufsize = 320 * 240 * 3; buf=mmap(0, bufsize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if (!buf) { printf ("mmap error.\n"); exit (1); } else { printf ("mmap successful.\n"); } result = munmap (buf, bufsize); printf ("unmap successful.\n"); close (fd); printf ("device closed.\n"); return (0); } --------------------------------------------------------------------- Is this gnat/florist error or just as what you mentioned about page alignment? I am using gcc/gnat 3.3.3 and florist 3.15p on SuSE Linux 9.1 Pro on AMD Athlon. I have no problem with both gcc/gnat and florist. My other programs using both for RS-232 interface have no problems at all. Now, I'm in despair with curiosity! :-) -- Adrian Hoe