summaryrefslogtreecommitdiffstats
path: root/source/tdb/tdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tdb/tdb.c')
-rw-r--r--source/tdb/tdb.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c
index 4143ac77819..ed75a55e3e9 100644
--- a/source/tdb/tdb.c
+++ b/source/tdb/tdb.c
@@ -34,7 +34,6 @@
#include <errno.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <signal.h>
#include "tdb.h"
#include "spinlock.h"
#else
@@ -161,18 +160,6 @@ struct list_struct {
*/
};
-/***************************************************************
- Allow a caller to set a "alarm" flag that tdb can check to abort
- a blocking lock on SIGALRM.
-***************************************************************/
-
-static sig_atomic_t *palarm_fired;
-
-void tdb_set_lock_alarm(sig_atomic_t *palarm)
-{
- palarm_fired = palarm;
-}
-
/* a byte range locking function - return 0 on success
this functions locks/unlocks 1 byte at the specified offset.
@@ -199,8 +186,6 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
do {
ret = fcntl(tdb->fd,lck_type,&fl);
- if (ret == -1 && errno == EINTR && palarm_fired && *palarm_fired)
- break;
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
@@ -532,20 +517,17 @@ int tdb_printfreelist(TDB_CONTEXT *tdb)
/* read in the freelist top */
if (ofs_read(tdb, offset, &rec_ptr) == -1) {
- tdb_unlock(tdb, -1, F_WRLCK);
return 0;
}
printf("freelist top=[0x%08x]\n", rec_ptr );
while (rec_ptr) {
if (tdb_read(tdb, rec_ptr, (char *)&rec, sizeof(rec), DOCONV()) == -1) {
- tdb_unlock(tdb, -1, F_WRLCK);
return -1;
}
if (rec.magic != TDB_FREE_MAGIC) {
printf("bad magic 0x%08x in free list\n", rec.magic);
- tdb_unlock(tdb, -1, F_WRLCK);
return -1;
}
@@ -1048,12 +1030,6 @@ static int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf)
}
/* find an entry in the database given a key */
-/* If an entry doesn't exist tdb_err will be set to
- * TDB_ERR_NOEXIST. If a key has no data attached
- * tdb_err will not be set. Both will return a
- * zero pptr and zero dsize.
- */
-
TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key)
{
tdb_off rec_ptr;
@@ -1064,11 +1040,8 @@ TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key)
if (!(rec_ptr = tdb_find_lock(tdb,key,F_RDLCK,&rec)))
return tdb_null;
- if (rec.data_len)
- ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len,
- rec.data_len);
- else
- ret.dptr = NULL;
+ ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len,
+ rec.data_len);
ret.dsize = rec.data_len;
tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK);
return ret;