You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bn...@apache.org on 2002/07/08 19:18:32 UTC

cvs commit: apache-1.3/src/modules/standard mod_rewrite.c

bnicholes    2002/07/08 10:18:32

  Modified:    src/modules/standard mod_rewrite.c
  Log:
  Since NetWare CLib does not implement file locking through fcntl() or flock(),
  used a semaphore to simulate the file locking behavior.
  
  Revision  Changes    Path
  1.178     +24 -0     apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.177
  retrieving revision 1.178
  diff -u -r1.177 -r1.178
  --- mod_rewrite.c	29 May 2002 17:39:23 -0000	1.177
  +++ mod_rewrite.c	8 Jul 2002 17:18:32 -0000	1.178
  @@ -99,6 +99,11 @@
   #include <sys/uio.h>
   #endif
   
  +#ifdef NETWARE
  +#include <nwsemaph.h>
  +static LONG locking_sem = 0;
  +#endif
  +
   /*
   ** +-------------------------------------------------------+
   ** |                                                       |
  @@ -3261,6 +3266,10 @@
           chown(lockname, ap_user_id, -1 /* no gid change */);
   #endif
   
  +#ifdef NETWARE
  +	locking_sem = OpenLocalSemaphore (1);
  +#endif
  +
       return;
   }
   
  @@ -3293,6 +3302,10 @@
       unlink(lockname);
       lockname = NULL;
       lockfd = -1;
  +#ifdef NETWARE
  +	CloseLocalSemaphore (locking_sem);
  +#endif
  +
   }
   
   static void rewritelock_alloc(request_rec *r)
  @@ -4140,6 +4153,12 @@
       rc = _locking(fd, _LK_LOCK, 1);
       lseek(fd, 0, SEEK_END);
   #endif
  +#ifdef NETWARE
  +	if ((locking_sem != 0) && (TimedWaitOnLocalSemaphore (locking_sem, 10000) != 0))
  +		rc = -1;
  +	else
  +		rc = 1;
  +#endif
   
       if (rc < 0) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
  @@ -4169,6 +4188,11 @@
       lseek(fd, 0, SEEK_SET);
       rc = _locking(fd, _LK_UNLCK, 1);
       lseek(fd, 0, SEEK_END);
  +#endif
  +#ifdef NETWARE
  +	if (locking_sem)
  +		SignalLocalSemaphore (locking_sem);
  +	rc = 1;
   #endif
   
       if (rc < 0) {