httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apache-1.3/src/modules/standard mod_auth_dbm.c
Date Wed, 02 Jan 2002 23:10:05 GMT
bnicholes    02/01/02 15:10:05

  Modified:    src/lib/sdbm sdbm_lock.c sdbm.c
               src/modules/standard mod_auth_dbm.c
  Log:
  File locking updates to make mod_auth_dbm work on NetWare
  Submitted by: Guenter Knauf
  
  Revision  Changes    Path
  1.3       +18 -1     apache-1.3/src/lib/sdbm/sdbm_lock.c
  
  Index: sdbm_lock.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/lib/sdbm/sdbm_lock.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sdbm_lock.c	4 Sep 2001 18:15:15 -0000	1.2
  +++ sdbm_lock.c	2 Jan 2002 23:10:05 -0000	1.3
  @@ -21,7 +21,7 @@
   #endif
   #if !defined(USE_FCNTL) && !defined(USE_FLOCK)
   #define USE_FLOCK 1
  -#if !defined(MPE) && !defined(WIN32)
  +#if !defined(MPE) && !defined(WIN32) && !defined(NETWARE)
   #include <sys/file.h>
   #endif
   #ifndef LOCK_UN
  @@ -40,6 +40,12 @@
   #define USE_LOCKING
   #include <sys/locking.h>
   #endif
  +#ifdef NETWARE
  +#undef USE_FCNTL
  +#define USE_SEM_LOCKING
  +#include <nwsemaph.h>
  +LONG locking_sem = 0;
  +#endif
   
   
   #ifdef USE_FCNTL
  @@ -78,6 +84,12 @@
       lseek(fd, 0, SEEK_SET);
       rc = _locking(fd, _LK_LOCK, 1);
   #endif
  +#ifdef USE_SEM_LOCKING
  +	if ((locking_sem != 0) && (TimedWaitOnLocalSemaphore (locking_sem, 10000) != 0))
  +		rc = -1;
  +	else
  +		rc = 1;
  +#endif
   
       return rc;
   }
  @@ -101,6 +113,11 @@
   #ifdef USE_LOCKING
       lseek(fd, 0, SEEK_SET);
       rc = _locking(fd, _LK_UNLCK, 1);
  +#endif
  +#ifdef USE_SEM_LOCKING
  +	if (locking_sem)
  +		SignalLocalSemaphore (locking_sem);
  +	rc = 1;
   #endif
   
       return rc;
  
  
  
  1.2       +14 -1     apache-1.3/src/lib/sdbm/sdbm.c
  
  Index: sdbm.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/lib/sdbm/sdbm.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sdbm.c	21 Sep 2000 13:06:14 -0000	1.1
  +++ sdbm.c	2 Jan 2002 23:10:05 -0000	1.2
  @@ -23,6 +23,9 @@
   #else
   #include <unistd.h>	/* for lseek() */
   #endif
  +#ifdef NETWARE
  +#include <nwsemaph.h>
  +#endif
   
   
   /*
  @@ -56,6 +59,9 @@
   };
   
   datum nullitem = {NULL, 0};
  +#ifdef NETWARE
  +extern LONG locking_sem;
  +#endif
   
   DBM *
   sdbm_open(file, flags, mode)
  @@ -84,6 +90,10 @@
   	pagname = strcpy(dirname + strlen(dirname) + 1, file);
   	pagname = strcat(pagname, PAGFEXT);
   
  +#ifdef NETWARE
  +	locking_sem = OpenLocalSemaphore (1);
  +#endif
  +
   	db = sdbm_prep(dirname, pagname, flags, mode);
   	free((char *) dirname);
   	return db;
  @@ -120,7 +130,7 @@
    * open the files in sequence, and stat the dirfile.
    * If we fail anywhere, undo everything, return NULL.
    */
  -#if defined(OS2) || defined(MSDOS) || defined(WIN32)
  +#if defined(OS2) || defined(MSDOS) || defined(WIN32) || defined(NETWARE)
   	flags |= O_BINARY;
   #endif
   	if ((db->pagf = open(pagname, flags, mode)) > -1) {
  @@ -166,6 +176,9 @@
   		(void) sdbm_fd_unlock(db->pagf);
   		(void) close(db->pagf);
   		free((char *) db);
  +#ifdef NETWARE
  +		CloseLocalSemaphore (locking_sem);
  +#endif
   	}
   }
   
  
  
  
  1.54      +1 -1      apache-1.3/src/modules/standard/mod_auth_dbm.c
  
  Index: mod_auth_dbm.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_auth_dbm.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_auth_dbm.c	21 Mar 2001 03:09:45 -0000	1.53
  +++ mod_auth_dbm.c	2 Jan 2002 23:10:05 -0000	1.54
  @@ -75,7 +75,7 @@
   #include "http_core.h"
   #include "http_log.h"
   #include "http_protocol.h"
  -#if defined(WIN32)
  +#if (defined(WIN32) || defined(NETWARE))
   #include <sdbm.h>
   #define dbm_open sdbm_open
   #define dbm_fetch sdbm_fetch
  
  
  

Mime
View raw message