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,ed7075f5ab49c273 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-05 11:32:45 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!dfw-service2.ext.ray.com.POSTED!53ab2750!not-for-mail From: Mark H Johnson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Files opened for exclusive read References: <686be06c.0403050513.632eb334@posting.google.com> <5b42c.5$QB4.4@dfw-service2.ext.ray.com> In-Reply-To: <5b42c.5$QB4.4@dfw-service2.ext.ray.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 05 Mar 2004 13:32:42 -0600 NNTP-Posting-Host: 192.27.48.39 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.ray.com 1078515164 192.27.48.39 (Fri, 05 Mar 2004 13:32:44 CST) NNTP-Posting-Date: Fri, 05 Mar 2004 13:32:44 CST Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:6095 Date: 2004-03-05T13:32:42-06:00 List-Id: Mark H Johnson wrote: > Preben Randhol wrote: > >> >> Will shared=yes be silently ignored on a linux/unix OS where this is not >> an issue? >> > It has been a couple years since I asked that question of ACT, but I > believe the answer is NO. When shared=yes, the GNAT run time will share > the file pointer (buffers, etc.). This was NOT what we wanted - we > happened to have more than one task reading some initialization data > from a file and were expecting each task to read the whole file (not > just pieces). > --Mark > In retrospect, my explanation is perhaps a little too brief. The following is a summary of a recent (5.02a) copy of the GNAT User's Guide (section 8.8, Shared Files) In the absence of a shared=xxx, attempting to open two or more files w/ the same full name is an error (raises USE_ERROR). If shared=no, the file can be opened with separate stream identifiers w/ the exact effect dependent on how the C stream routines do this. If shared=yes and two or more files are opened with the same full name, the same stream is shared between the files w/ the semantics in section A.14 of the Ada Reference Manual. So, to recap - shared=yes is not ignored, the semantics in the ARM are followed. If you want to open the same file more than once w/o error and without sharing, use shared=no. [at least this is how it works on x86 Linux, I can't comment on other machine/OS combinations] --Mark