From: Bradley Nicholes Date: Mon, 8 Jul 2002 17:18:32 +0000 (+0000) Subject: Since NetWare CLib does not implement file locking through fcntl() or flock(), X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6e7114f9dce1abc4eaba528777704edd5013416;p=thirdparty%2Fapache%2Fhttpd.git Since NetWare CLib does not implement file locking through fcntl() or flock(), 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 --- diff --git a/src/modules/standard/mod_rewrite.c b/src/modules/standard/mod_rewrite.c index cf8e48b3806..4dee75c5a53 100644 --- a/src/modules/standard/mod_rewrite.c +++ b/src/modules/standard/mod_rewrite.c @@ -99,6 +99,11 @@ #include #endif +#ifdef NETWARE +#include +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,