]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Since NetWare CLib does not implement file locking through fcntl() or flock(),
authorBradley Nicholes <bnicholes@apache.org>
Mon, 8 Jul 2002 17:18:32 +0000 (17:18 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Mon, 8 Jul 2002 17:18:32 +0000 (17:18 +0000)
used a semaphore to simulate the file locking behavior.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@95973 13f79535-47bb-0310-9956-ffa450edef68

src/modules/standard/mod_rewrite.c

index cf8e48b38064eb1d007282bb743c8ca951d000a5..4dee75c5a53caf602d1533dc176af6af5d3b45a7 100644 (file)
 #include <sys/uio.h>
 #endif
 
+#ifdef NETWARE
+#include <nwsemaph.h>
+static LONG locking_sem = 0;
+#endif
+
 /*
 ** +-------------------------------------------------------+
 ** |                                                       |
@@ -3261,6 +3266,10 @@ static void rewritelock_create(server_rec *s, pool *p)
         chown(lockname, ap_user_id, -1 /* no gid change */);
 #endif
 
+#ifdef NETWARE
+       locking_sem = OpenLocalSemaphore (1);
+#endif
+
     return;
 }
 
@@ -3293,6 +3302,10 @@ static void rewritelock_remove(void *data)
     unlink(lockname);
     lockname = NULL;
     lockfd = -1;
+#ifdef NETWARE
+       CloseLocalSemaphore (locking_sem);
+#endif
+
 }
 
 static void rewritelock_alloc(request_rec *r)
@@ -4140,6 +4153,12 @@ static void fd_lock(request_rec *r, int fd)
     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,
@@ -4170,6 +4189,11 @@ static void fd_unlock(request_rec *r, int fd)
     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) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, r,