projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added support for 64 bit input file support.
[idzebra-moved-to-github.git]
/
index
/
lockutil.c
diff --git
a/index/lockutil.c
b/index/lockutil.c
index
bebe318
..
123f7e6
100644
(file)
--- a/
index/lockutil.c
+++ b/
index/lockutil.c
@@
-1,10
+1,16
@@
/*
/*
- * Copyright (C) 1994-1997, Index Data I/S
+ * Copyright (C) 1994-1999, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockutil.c,v $
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockutil.c,v $
- * Revision 1.10 1997-09-29 09:08:36 adam
+ * Revision 1.12 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.11 1999/02/02 14:50:59 adam
+ * Updated WIN32 code specific sections. Changed header.
+ *
+ * Revision 1.10 1997/09/29 09:08:36 adam
* Revised locking system to be thread safe for the server.
*
* Revision 1.9 1997/09/25 14:54:43 adam
* Revised locking system to be thread safe for the server.
*
* Revision 1.9 1997/09/25 14:54:43 adam
@@
-46,7
+52,7
@@
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <io.h>
#include <sys/locking.h>
#else
#include <io.h>
#include <sys/locking.h>
#else
@@
-62,10
+68,10
@@
struct zebra_lock_info {
ZebraLockHandle zebra_lock_create (const char *name, int excl_flag)
{
ZebraLockHandle zebra_lock_create (const char *name, int excl_flag)
{
- ZebraLockHandle h = xmalloc (sizeof(*h));
+ ZebraLockHandle h = (ZebraLockHandle) xmalloc (sizeof(*h));
h->excl_flag = excl_flag;
h->fd = -1;
h->excl_flag = excl_flag;
h->fd = -1;
-#ifdef WINDOWS
+#ifdef WIN32
if (!h->excl_flag)
h->fd = open (name, O_BINARY|O_RDONLY);
if (h->fd == -1)
if (!h->excl_flag)
h->fd = open (name, O_BINARY|O_RDONLY);
if (h->fd == -1)
@@
-103,9
+109,7
@@
void zebra_lock_prefix (Res res, char *path)
strcat (path, "/");
}
strcat (path, "/");
}
-#ifdef WINDOWS
-
-#else
+#ifndef WIN32
static int unixLock (int fd, int type, int cmd)
{
struct flock area;
static int unixLock (int fd, int type, int cmd)
{
struct flock area;
@@
-118,7
+122,7
@@
static int unixLock (int fd, int type, int cmd)
int zebra_lock (ZebraLockHandle h)
{
int zebra_lock (ZebraLockHandle h)
{
-#ifdef WINDOWS
+#ifdef WIN32
return _locking (h->fd, _LK_LOCK, 1);
#else
return unixLock (h->fd, h->excl_flag ? F_WRLCK : F_RDLCK, F_SETLKW);
return _locking (h->fd, _LK_LOCK, 1);
#else
return unixLock (h->fd, h->excl_flag ? F_WRLCK : F_RDLCK, F_SETLKW);
@@
-127,7
+131,7
@@
int zebra_lock (ZebraLockHandle h)
int zebra_lock_nb (ZebraLockHandle h)
{
int zebra_lock_nb (ZebraLockHandle h)
{
-#ifdef WINDOWS
+#ifdef WIN32
return _locking (h->fd, _LK_NBLCK, 1);
#else
return unixLock (h->fd, h->excl_flag ? F_WRLCK : F_RDLCK, F_SETLK);
return _locking (h->fd, _LK_NBLCK, 1);
#else
return unixLock (h->fd, h->excl_flag ? F_WRLCK : F_RDLCK, F_SETLK);
@@
-136,7
+140,7
@@
int zebra_lock_nb (ZebraLockHandle h)
int zebra_unlock (ZebraLockHandle h)
{
int zebra_unlock (ZebraLockHandle h)
{
-#ifdef WINDOWS
+#ifdef WIN32
return _locking (h->fd, _LK_UNLCK, 1);
#else
return unixLock (h->fd, F_UNLCK, F_SETLKW);
return _locking (h->fd, _LK_UNLCK, 1);
#else
return unixLock (h->fd, F_UNLCK, F_SETLKW);