summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-07-29 03:08:05 +0000
committerAndrew Tridgell <tridge@samba.org>1998-07-29 03:08:05 +0000
commit64578c0589a3a741f81fb55c16eeb882128da00b (patch)
tree8b650156e44e4d39af8625185d857a88789b8074 /source3/locking
parentc48b3fce6be6d5d952cbcda0ddae223dda5a576f (diff)
downloadsamba-64578c0589a3a741f81fb55c16eeb882128da00b.tar.gz
samba-64578c0589a3a741f81fb55c16eeb882128da00b.tar.bz2
samba-64578c0589a3a741f81fb55c16eeb882128da00b.zip
merge from the autoconf2 branch to the main branch
(This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c11
-rw-r--r--source3/locking/locking_shm.c9
-rw-r--r--source3/locking/locking_slow.c46
-rw-r--r--source3/locking/shmem.c6
-rw-r--r--source3/locking/shmem_sysv.c11
5 files changed, 21 insertions, 62 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e4ca6bbb04..e303fb5482 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -88,7 +88,7 @@ BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset, int lock_type)
* Note that most UNIX's can *test* for a write lock on
* a read-only fd, just not *set* a write lock on a read-only
* fd. So we don't need to use map_lock_type here.
- */
+ */
return(fcntl_lock(fsp->fd_ptr->fd,F_GETLK,offset,count,lock_type));
}
@@ -161,13 +161,10 @@ BOOL locking_init(int read_only)
#ifdef FAST_SHARE_MODES
share_ops = locking_shm_init(read_only);
- if (!share_ops) {
- DEBUG(0,("ERROR: Failed to initialise fast share modes - trying slow code\n"));
- }
- if (share_ops) return True;
-#endif
-
+#else
share_ops = locking_slow_init(read_only);
+#endif
+
if (!share_ops) {
DEBUG(0,("ERROR: Failed to initialise share modes!\n"));
return False;
diff --git a/source3/locking/locking_shm.c b/source3/locking/locking_shm.c
index afca567033..43a927e14c 100644
--- a/source3/locking/locking_shm.c
+++ b/source3/locking/locking_shm.c
@@ -32,9 +32,10 @@
October 1997 - split into separate file (tridge)
*/
+#include "includes.h"
+
#ifdef FAST_SHARE_MODES
-#include "includes.h"
extern int DEBUGLEVEL;
extern connection_struct Connections[];
extern files_struct Files[];
@@ -678,13 +679,15 @@ struct share_ops *locking_shm_init(int ronly)
{
read_only = ronly;
-#ifdef USE_SYSV_IPC
+#ifdef HAVE_SYSV_IPC
shmops = sysv_shm_open(read_only);
if (shmops) return &share_ops;
#endif
+#ifdef HAVE_SHARED_MMAP
shmops = smb_shm_open(read_only);
if (shmops) return &share_ops;
+#endif
return NULL;
}
@@ -692,7 +695,7 @@ struct share_ops *locking_shm_init(int ronly)
#else
int locking_shm_dummy_procedure(void)
{return 0;}
-#endif
+#endif /* FAST_SHARE_MODES */
diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c
index 183acd1f44..1f8f962ac9 100644
--- a/source3/locking/locking_slow.c
+++ b/source3/locking/locking_slow.c
@@ -33,6 +33,9 @@
*/
#include "includes.h"
+
+#ifndef FAST_SHARE_MODES
+
extern int DEBUGLEVEL;
extern connection_struct Connections[];
extern files_struct Files[];
@@ -504,17 +507,8 @@ mode file %s (%s)\n", fname, strerror(errno)));
return 0;
}
/* Now truncate the file at this point. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, newsize)!= 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: get_share_modes: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
if(*old_shares)
@@ -526,10 +520,6 @@ mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
}
}
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(buf)
free(buf);
@@ -670,27 +660,14 @@ mode file %s (%s)\n", fname, strerror(errno)));
}
/* Now truncate the file at this point. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, newsize) != 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: del_share_mode: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
if(buf)
free(buf);
return;
}
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
}
/*******************************************************************
@@ -825,17 +802,8 @@ deleting it (%s).\n",fname, strerror(errno)));
/* Now truncate the file at this point - just for safety. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, header_size + (SMF_ENTRY_LENGTH*num_entries))!= 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: set_share_mode: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entries),
strerror(errno)));
@@ -844,10 +812,6 @@ mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entr
return False;
}
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(buf)
free(buf);
@@ -1093,3 +1057,7 @@ struct share_ops *locking_slow_init(int ronly)
return &share_ops;
}
+#else
+ int locking_slow_dummy_procedure(void)
+{return 0;}
+#endif /* !FAST_SHARE_MODES */
diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c
index 21aaa9e24f..48f78d2a5b 100644
--- a/source3/locking/shmem.c
+++ b/source3/locking/shmem.c
@@ -23,7 +23,7 @@
#include "includes.h"
-#ifdef FAST_SHARE_MODES
+#ifdef HAVE_SHARED_MMAP
extern int DEBUGLEVEL;
@@ -874,7 +874,7 @@ struct shmem_ops *smb_shm_open(int ronly)
}
-#else /* FAST_SHARE_MODES */
+#else /* HAVE_SHARED_MMAP */
int shmem_dummy_procedure(void)
{return 0;}
-#endif /* FAST_SHARE_MODES */
+#endif /* HAVE_SHARED_MMAP */
diff --git a/source3/locking/shmem_sysv.c b/source3/locking/shmem_sysv.c
index 3466930f4c..0809e0546f 100644
--- a/source3/locking/shmem_sysv.c
+++ b/source3/locking/shmem_sysv.c
@@ -23,7 +23,7 @@
#include "includes.h"
-#ifdef USE_SYSV_IPC
+#ifdef HAVE_SYSV_IPC
extern int DEBUGLEVEL;
@@ -542,15 +542,6 @@ struct shmem_ops *sysv_shm_open(int ronly)
int i;
int pid;
-
-
-#ifdef LINUX
- if (sizeof(shm_ds) == 52) {
- DEBUG(0,("WARNING: You probably have a broken set of glibc2 include files - disabling sysv shared memory\n"));
- return NULL;
- }
-#endif
-
read_only = ronly;
shm_size = lp_shmem_size();