r23367: check the "use mmap" option for ldb too
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 Jun 2007 13:02:14 +0000 (13:02 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:10 +0000 (12:23 -0500)
source/groupdb/mapping_ldb.c
source/lib/ldb/include/ldb.h
source/lib/ldb/ldb_tdb/ldb_tdb.c

index 8eafc2532b42477695fc6aabdb44ad1d0bf15ce9..4f3aa1853403ac15d12df4236d25cd62e1fedd14 100644 (file)
@@ -67,6 +67,10 @@ static BOOL init_group_mapping(void)
                flags |= LDB_FLG_NOSYNC;
        }
 
+       if (!lp_use_mmap()) {
+               flags |= LDB_FLG_NOMMAP;
+       }
+
        ret = ldb_connect(ldb, db_path, flags, NULL);
        if (ret != LDB_SUCCESS) {
                goto failed;
index 44f9e5f3df735a1bd273a273fe7cc25a725f38dd..f96b90a1b2d524ed94d34875ddf5c79556c8b9b4 100644 (file)
@@ -233,6 +233,11 @@ struct ldb_utf8_fns {
 */
 #define LDB_FLG_RECONNECT 4
 
+/**
+   Flag to tell backends not to use mmap
+*/
+#define LDB_FLG_NOMMAP 8
+
 /*
    structures for ldb_parse_tree handling code
 */
index fead100f728f37dbd45b72f877e4c1dc7d8e265a..8b53982fdb351d9a52b98f6f640062845e8a5c94 100644 (file)
@@ -1029,6 +1029,11 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
                tdb_flags |= TDB_NOSYNC;
        }
 
+       /* and nommap option */
+       if (flags & LDB_FLG_NOMMAP) {
+               tdb_flags |= TDB_NOMMAP;
+       }
+
        if (flags & LDB_FLG_RDONLY) {
                open_flags = O_RDONLY;
        } else {