Exemple #1
0
Fichier : tdb.c Projet : GSam/samba
/*
  increment the tdb sequence number if the tdb has been opened using
  the TDB_SEQNUM flag
*/
static void tdb_increment_seqnum(struct tdb_context *tdb)
{
	if (!(tdb->flags & TDB_SEQNUM)) {
		return;
	}

	if (tdb->transaction != NULL) {
		tdb_increment_seqnum_nonblock(tdb);
		return;
	}

	if (tdb_nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK,
			  TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
		return;
	}

	tdb_increment_seqnum_nonblock(tdb);

	tdb_nest_unlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, false);
}
Exemple #2
0
/*
  increment the tdb sequence number if the tdb has been opened using
  the TDB_SEQNUM flag
*/
static void tdb_increment_seqnum(struct tdb_context *tdb)
{
	if (!(tdb->flags & TDB_SEQNUM)) {
		return;
	}

	if (tdb_brlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, F_SETLKW, 1, 1) != 0) {
		return;
	}

	tdb_increment_seqnum_nonblock(tdb);

	tdb_brlock(tdb, TDB_SEQNUM_OFS, F_UNLCK, F_SETLKW, 1, 1);
}
Exemple #3
0
static PyObject *obj_increment_seqnum_nonblock(PyTdbObject *self)
{
	PyErr_TDB_RAISE_IF_CLOSED(self);
	tdb_increment_seqnum_nonblock(self->ctx);
	Py_RETURN_NONE;
}