Linux, Gnu Pascal, and CGI's.

Linux, Gnu Pascal, and CGI's.

Post by Chris Woo » Mon, 28 Dec 1998 04:00:00



    First, let me say that I hope that I have chosen the correct newsgroup
to post my questions to.  If anyone out there feels that I have posted to
the appropriate newsgroup, I do apologize.

    Now, my situation is as follows:  I am developing a CGI script using Gnu
Pascal, which is to be run in a Linux environment.  It is a fairly simple
CGI I suppose, just a database program, but I need to make sure that
multiple running occurances of the CGI script do not interfere with each
others processes.  The simplest way that I can think of to do this (and the
method that I am trying to implement now) is to have each occurance of the
CGI script create a simple text (called "CGI-BUSY.TXT" for instance) which
acts as a flag to let all other running occurances of the script know that
the script is already running.  The occurance of the script that is executed
first, has priority and is allowed to finish it's execution before the next
occurance can proceed.

    So far I have been able to create the 'flag file' (i.e. "CGI-BUSY.TXT"),
and let the CGI script execute thoroughly, but when it is done executing, it
fails to remove the flag file from the file system, which prevents the next
occurance of the CGI script from progressing any further than the initial
check for the existance of the flag file.  Here is a little snipet of code
from the script that I am working on:

    ...
    ...
    Close(BusyFile);
    remove('CGIBUSY.$$$');
    ...
    ...

    The 'remove()' procedure is a 'C' function.  Can anyone tell me if I am
using the function properly, or give me an idea as to why my script is
failing to remove the flag file?  Better yet,  can help me to find another
(more efficient) way of communicating between multiple running occurances of
a CGI script???  That would be MOST appreciated. :)

        Chris Wood

 
 
 

Linux, Gnu Pascal, and CGI's.

Post by Dennis Pay » Sat, 02 Jan 1999 04:00:00



>     The 'remove()' procedure is a 'C' function.  Can anyone tell me if I am
> using the function properly, or give me an idea as to why my script is
> failing to remove the flag file?  Better yet,  can help me to find another
> (more efficient) way of communicating between multiple running occurances of
> a CGI script???  That would be MOST appreciated. :)

Does GNU Pascal automatically translate from Pascal strings to C strings?
(If not that is probably your problem.)  A better way of doing it would
probably be with semaphores.  (see man pages for sem_init, sem_get,
...)  However I haven't used them from pascal (or C for that matter).
I think they might also need to be created in one process and then just
used by the others which would be problematic in your case.  Another
possibility is to use fastcgi.  That keeps the cgi process running and
just forward requests to it from the web browser.  Then mutexes
or semaphores could be used or the process could simply be made single
threaded.  Granted I've never used this either.

Dennis Payne


 
 
 

1. Here is location of GNU pascal

        I got alot of people asking me where...?
Ok.

You can find it at kampi.hut.fi  in  jtv/gnu-pascal

It's a funny compiler and is in ultra-alpha testing.. :)
I just don't that the space to compile it, so I pass it to
anyone who will.  I may have to suffice with the p2c translating
program...

Dan "poor boy" Miner

--
 Dan Miner

Computer Science          
University of Missouri-Rolla             "It all begins with a glimmer."

2. US-WA-Seattle **Huge Project .. P / A s with HP-UX performance -sc

3. GNU Pascal

4. Please help set up PPP server (Urgent)

5. gnu pascal and redhat

6. mitsumi sound level not working

7. what about an integrated development enviroment on free(gnu)pascal?

8. Use of X libraries under X11R6

9. Help with documentation to GNU Pascal gpc-2.6.3

10. GNU Pascal Compiler

11. GNU pascal question

12. gnu pascal and redhat 5.0

13. gnu pascal