[fpc-pascal] File locking/protection in Linux

L505 fpc505 at z505.com
Wed Nov 2 01:16:07 CET 2005


> How can be avoided in Linux the file corruption due to simultaneous write
> access from two different process?
> Or how can it be avoided to access the same file by two different process?
> I experienced a few (but painful) data loss due to this problem, and I'm
> unable to solve the problem.


The Pascal Server Pages project has a unit in it that allows this if you are interested. It
is not specific to Pascal Server Pages as far as I know.

Basically how it works is a simple time delay is put on the file until it is free again.
You can check FileShare.pp if you are intersted in a file locking read/write method.

SVN:
https://opensvn.csie.org/pspcgi/psp-1.5.x-devel/src/fileshare.pp

For documentation on how those units would be used, check:
http://z505.com/cgi-bin/psp/docs/1.4.1/psp_doc_i.cgi?p=mod.fileshare.html

Again, these units and documentation were written with regards to CGI programming. However,
file sharing is not specific to cgi programming of course!




More information about the fpc-pascal mailing list