summaryrefslogtreecommitdiff
path: root/source3/lib/server_mutex.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-12 23:01:08 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-13 14:06:07 +0200
commit01c934c81e55b79601122d8e0740c7946077c37e (patch)
treef6e7909690bc399c3036ef80e22997aadbf88884 /source3/lib/server_mutex.c
parent3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c (diff)
downloadsamba-01c934c81e55b79601122d8e0740c7946077c37e.tar.gz
samba-01c934c81e55b79601122d8e0740c7946077c37e.tar.bz2
samba-01c934c81e55b79601122d8e0740c7946077c37e.zip
lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett
Diffstat (limited to 'source3/lib/server_mutex.c')
-rw-r--r--source3/lib/server_mutex.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c
index dc65819197..7ceecfe770 100644
--- a/source3/lib/server_mutex.c
+++ b/source3/lib/server_mutex.c
@@ -22,6 +22,7 @@
#include "system/filesys.h"
#include "lib/util/tdb_wrap.h"
#include "util_tdb.h"
+#include "lib/param/param.h"
/* For reasons known only to MS, many of their NT/Win2k versions
need serialised access only. Two connections at the same time
@@ -46,13 +47,20 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
int timeout)
{
struct named_mutex *result;
-
+ struct loadparm_context *lp_ctx;
result = talloc(mem_ctx, struct named_mutex);
if (result == NULL) {
DEBUG(0, ("talloc failed\n"));
return NULL;
}
+ lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
+ talloc_free(result);
+ return NULL;
+ }
+
result->name = talloc_strdup(result, name);
if (result->name == NULL) {
DEBUG(0, ("talloc failed\n"));
@@ -61,7 +69,8 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
}
result->tdb = tdb_wrap_open(result, lock_path("mutex.tdb"), 0,
- TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ TDB_DEFAULT, O_RDWR|O_CREAT, 0600, lp_ctx);
+ talloc_unlink(result, lp_ctx);
if (result->tdb == NULL) {
DEBUG(1, ("Could not open mutex.tdb: %s\n",
strerror(errno)));