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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Exclusive file access Date: Fri, 28 Aug 2015 14:38:31 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <75714e3f-c047-413d-9aa5-3ff423167863@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 28 Aug 2015 21:36:47 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="3901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1941eYU3AFTIxjZUVBSTtIXwiUL3/T5wrQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: Cancel-Lock: sha1:L6stSbWN5m42dIHF64qkDeYI2n0= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:27633 Date: 2015-08-28T14:38:31-07:00 List-Id: On 08/28/2015 02:06 PM, Simon Wright wrote: > > As another data point, on OS X it seems that only the output from the > last process to close the file actually appears. I've also seen this on Linux. Apparently the buffer is big enough to hold the entire file, and is not written to disk until the file is closed. Since all programs start writing from the beginning of the file, each subsequent one overwrites the previous one. If the file were bigger than the buffer, or Flush were used, one might get different results (especially if the output of the programs is not all the same). > Perhaps GNAT.Lock_Files might help? A lock file will work if all the programs that will access the file will be written to use the lock file. If you have to protect against any arbitrary program accessing the file, then you have to use OS features. -- Jeff Carter "Propose to an Englishman any principle, or any instrument, however admirable, and you will observe that the whole effort of the English mind is directed to find a difficulty, a defect, or an impossibility in it. If you speak to him of a machine for peeling a potato, he will pronounce it impossible: if you peel a potato with it before his eyes, he will declare it useless, because it will not slice a pineapple." Charles Babbage 92