BOOL locking_init(int read_only) { brl_init(read_only); if (tdb) return True; tdb = tdb_open_log(lock_path("locking.tdb"), lp_open_files_db_hash_size(), TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST), read_only?O_RDONLY:O_RDWR|O_CREAT, 0644); if (!tdb) { DEBUG(0,("ERROR: Failed to initialise locking database\n")); return False; } /* Activate the per-hashchain freelist */ tdb_set_max_dead(tdb, 5); if (!posix_locking_init(read_only)) return False; open_read_only = read_only; return True; }
static int obj_set_max_dead(PyTdbObject *self, PyObject *max_dead, void *closure) { PyErr_TDB_RAISE_RETURN_MINUS_1_IF_CLOSED(self); if (!PyInt_Check(max_dead)) return -1; tdb_set_max_dead(self->ctx, PyInt_AsLong(max_dead)); return 0; }