1 /* config.c - bdb backend configuration file routine */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
23 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
26 fprintf( stderr, "%s: line %d: "
27 "bdb database info is null!\n",
32 /* directory is the DB_HOME */
33 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
35 fprintf( stderr, "%s: line %d: "
36 "missing dir in \"directory <dir>\" line\n",
40 if ( bdb->bi_dbenv_home ) {
41 free( bdb->bi_dbenv_home );
43 bdb->bi_dbenv_home = ch_strdup( argv[1] );
46 /* transaction checkpoint configuration */
47 } else if ( strcasecmp( argv[0], "dbnosync" ) == 0 ) {
48 bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
50 /* transaction checkpoint configuration */
51 } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) {
53 fprintf( stderr, "%s: line %d: "
54 "missing parameters in \"checkpoint <kbyte> <min>\" line\n",
59 bdb->bi_txn_cp_kbyte = strtol( argv[1], NULL, 0 );
60 bdb->bi_txn_cp_min = strtol( argv[2], NULL, 0 );
62 /* lock detect configuration */
63 } else if ( strcasecmp( argv[0], "lockdetect" ) == 0 ) {
66 fprintf( stderr, "%s: line %d: "
67 "missing parameters in \"lockDetect <policy> <seconds>\" line\n",
72 if( strcasecmp( argv[1], "default" ) == 0 ) {
73 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
75 } else if( strcasecmp( argv[1], "oldest" ) == 0 ) {
76 bdb->bi_lock_detect = DB_LOCK_OLDEST;
78 } else if( strcasecmp( argv[1], "random" ) == 0 ) {
79 bdb->bi_lock_detect = DB_LOCK_RANDOM;
81 } else if( strcasecmp( argv[1], "youngest" ) == 0 ) {
82 bdb->bi_lock_detect = DB_LOCK_YOUNGEST;
85 fprintf( stderr, "%s: line %d: "
86 "bad policy (%s) in \"lockDetect <policy> <seconds>\" line\n",
87 fname, lineno, argv[1] );
91 bdb->bi_lock_detect_seconds = strtol( argv[2], NULL, 0 );
92 if( bdb->bi_lock_detect_seconds < 1 ) {
93 fprintf( stderr, "%s: line %d: "
94 "bad seconds (%s) in \"lockDetect <policy> <seconds>\" line\n",
95 fname, lineno, argv[2] );
99 fprintf( stderr, "%s: line %d: "
100 "NO THREADS: lockDetect line ignored\n",
104 /* mode with which to create new database files */
105 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
107 fprintf( stderr, "%s: line %d: "
108 "missing mode in \"mode <mode>\" line\n",
112 bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
114 #if BDB_CONFIG_INDICES
115 /* attribute to index */
116 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
119 fprintf( stderr, "%s: line %d: "
120 "missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
123 } else if ( argc > 3 ) {
124 fprintf( stderr, "%s: line %d: "
125 "extra junk after \"index <attr> [pres,eq,approx,sub]\" "
129 rc = bdb_attr_index_config( bdb, fname, lineno, argc - 1, &argv[1] );
131 if( rc != LDAP_SUCCESS ) return 1;
136 fprintf( stderr, "%s: line %d: "
137 "unknown directive \"%s\" in bdb database definition (ignored)\n",
138 fname, lineno, argv[0] );