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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5b518364bbeba851 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news.tele.dk!not-for-mail Sender: malo@0x535ba173.boanxx18.adsl-dhcp.tele.dk Newsgroups: comp.lang.ada Subject: Re: POSIX_Generic_Shared_Memory References: <1095700990.407634.230970@k26g2000oda.googlegroups.com> From: Mark Lorenzen Date: 27 Sep 2004 22:46:34 +0200 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: TDC Totalloesninger NNTP-Posting-Host: 83.91.161.115 X-Trace: 1096317999 dtext02.news.tele.dk 159 83.91.161.115:36050 X-Complaints-To: abuse@post.tele.dk Xref: g2news1.google.com comp.lang.ada:4286 Date: 2004-09-27T22:46:34+02:00 List-Id: "Mattias Lindblad" writes: > Hi, > > I have found some problems when experimenting with the > POSIX_Generic_Shared_Memory package. Let's start with a code example to > illustrate my point: > [example and decription removed] > However, the client raises a Storage_Error when trying to access the > shared data. I have found that this is because the Protection_Options > are passed straight through to Map_Memory, and in my case this leads to > a memory region that is write-only. > > The obvious solution would of course be to set Protection_Options to > (Allow_Write + Allow_Read). Unfortunately, by doing this the > Open_Shared_Memory will be called with a mode of Read_Only. This feels > a bit weird, but follows the POSIX 1003.5b standard, 12.5.1.2(1): "If > the value of Protection is set to Allow_Write, Mode is Read_Write; > otherwise Mode is Read_Only." (From the 1996 version, I'm afraid I > haven't access to an updated version). > > Is this really how it is supposed to work? In my opinion the standard > text should read "If the value of Protection *includes* Allow_Write > [...]". The ISO/IEC 14519 standard says: [Open_And_Map_Shared_Memory] If the value of Protection is set to Allow_Write, Mode is Read_Write; otherwise Mode is Read_Only. [Open_Or_Create_And_Map_Shared_Memory] If the value of Protection is set to Allow_Write, Mode is Read_Write; otherwise Mode is Read_Only. > > I have only tried this with GNAT 3.15p and Florist. So I don't know if > this might be specific to this system or if it is more general. > > Any ideas about this? Is it a bug in GNAT, the standard, both of them > or none of them (i.e. I'm not doing things the way I'm supposed to)? Looking at the source code for florist 3.5.0_20040403, it seems that it is NOT florist, that is to blame. What version of florist do you use? Try to look in the file posix-generic_shared_memory.adb for the two functions you use and inspect that they contain the following statement: if Protection = POSIX.Memory_Mapping.Allow_Write then Mode := POSIX.IO.Read_Write; else Mode := POSIX.IO.Read_Only; end if; > Thanks, > Mattias Regards, - Mark Lorenzen