コード例 #1
0
ファイル: open.c プロジェクト: Marvin-Lee/libwmiclient
/* reopen all tdb's */
int tdb_reopen_all(int parent_longlived)
{
	struct tdb_context *tdb;

	for (tdb=tdbs; tdb; tdb = tdb->next) {
		/*
		 * If the parent is longlived (ie. a
		 * parent daemon architecture), we know
		 * it will keep it's active lock on a
		 * tdb opened with CLEAR_IF_FIRST. Thus
		 * for child processes we don't have to
		 * add an active lock. This is essential
		 * to improve performance on systems that
		 * keep POSIX locks as a non-scalable data
		 * structure in the kernel.
		 */
		if (parent_longlived) {
			/* Ensure no clear-if-first. */
			tdb->flags &= ~TDB_CLEAR_IF_FIRST;
		}

		if (tdb_reopen(tdb) != 0)
			return -1;
	}

	return 0;
}
コード例 #2
0
ファイル: pytdb.c プロジェクト: AIdrifter/samba
static PyObject *obj_reopen(PyTdbObject *self)
{
	int ret;
	PyErr_TDB_RAISE_IF_CLOSED(self);
	ret = tdb_reopen(self->ctx);
	if (ret != 0) {
		self->closed = true;
		PyErr_SetObject(PyExc_RuntimeError,
				Py_BuildValue("(i,s)",
					      TDB_ERR_IO,
					      "Failed to reopen database"));
		return NULL;
	}
	Py_RETURN_NONE;
}