I am in the process of developing a CGI program using GNU Pascal.  The CGI program is to be used in a Linux environment.  It is a database CGI script and I would like to have one running process of the CGI script have exclusive write access.  I was hoping that someone could provide me with an example, or a place where I can find further (detailed) information, of using the flock() function from the C library in a GNU Pascal program.  I also need to know how to detect when a file is locked.  A million thanks for your time and help.
 
Sincerely,
Chris Wood