summaryrefslogtreecommitdiffstats
path: root/source/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
commit3bda7ac417107a7b01d91805ca71c4330657ed21 (patch)
tree0fb2fb0cbd2df1b77ea814ba30e2bb1f8a1d999f /source/locking
parent7b3a9d6285cc0d1967155a68845e28c6296ecc67 (diff)
downloadsamba-3bda7ac417107a7b01d91805ca71c4330657ed21.tar.gz
samba-3bda7ac417107a7b01d91805ca71c4330657ed21.tar.xz
samba-3bda7ac417107a7b01d91805ca71c4330657ed21.zip
merge from the autoconf2 branch to the main branch
Diffstat (limited to 'source/locking')
-rw-r--r--source/locking/locking.c11
-rw-r--r--source/locking/locking_shm.c9
-rw-r--r--source/locking/locking_slow.c46
-rw-r--r--source/locking/shmem.c6
-rw-r--r--source/locking/shmem_sysv.c11
5 files changed, 21 insertions, 62 deletions
diff --git a/source/locking/locking.c b/source/locking/locking.c
index e4ca6bbb049..e303fb54821 100644
--- a/source/locking/locking.c
+++ b/source/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/source/locking/locking_shm.c b/source/locking/locking_shm.c
index afca567033a..43a927e14c7 100644
--- a/source/locking/locking_shm.c
+++ b/source/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/source/locking/locking_slow.c b/source/locking/locking_slow.c
index 183acd1f440..1f8f962ac90 100644
--- a/source/locking/locking_slow.c
+++ b/source/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/source/locking/shmem.c b/source/locking/shmem.c
index 21aaa9e24f5..48f78d2a5bb 100644
--- a/source/locking/shmem.c
+++ b/source/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/source/locking/shmem_sysv.c b/source/locking/shmem_sysv.c
index 3466930f4c6..0809e0546f5 100644
--- a/source/locking/shmem_sysv.c
+++ b/source/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();