[Info-vax] Multiple File Readers/Writers

chrisj.doran%proemail.co.uk at gtempaccount.com chrisj.doran%proemail.co.uk at gtempaccount.com
Thu Nov 24 20:48:54 EST 2011


On Nov 25, 1:29 am, Matt <matt-nos... at 9track.net> wrote:
> I'm trying to port SQLite to OpenVMS/Integrity. It's mostly working so
> far with only a few minor changes required thanks to the 'unix
> compatibility' layer in the C runtime library. However what doesn't work
> is the ability for multiple processes to access the same database file
> at the same time.
>
> I've written two small test programs using the same functions as the
> SQLite module to demonstrate the problem. One is called 'writer' which
> opens a file test.dat and writes a counter every second into the first
> few bytes. The second program 'reader' opens the same file and displays
> the counter once per second. I've tried them on Windows and Linux and
> they work as expected, however on VMS the counter never updates and the
> reader seems to be dealing with a cached version of the file on disk.
> The only way to get the counter to update is to close and open the file
> on every read operation.
>
> I've read the relevant sections of 'Guide to OpenVMS File Applications',
> 'OpenVMS Record Management Services Reference Manual' and the 'C
> Run-Time Library Reference Manual' and tried many combinations of
> options but always get the same result.
>
> What combination of parameters do I need to pass to the 'open' call to
> get the file sharing to work properly so that the reader does not get
> stale data?
>
> The test programs are located here:
>
> http://www.9track.net/vms/reader.chttp://www.9track.net/vms/writer.c
>
> Thanks,
>
> Matt

It's been a while, but I have a vague recollection of having the same
problem and needing to replace fsync with fflush, or use both, despite
the docs implying they do the same thing. Sorry, don't have time to
investigate at this precise moment.

Chris



More information about the Info-vax mailing list