#endif
+/* 4.6.18 redefines cursor->locker */
+#if DB_VERSION_FULL >= 0x04060012
+
+struct __db_locker {
+ u_int32_t id;
+};
+
+#define CURSOR_SETLOCKER(cursor, id) \
+ __lock_getlocker(cursor->dbp->dbenv->lk_handle, id, 0, &cursor->locker)
+#define CURSOR_GETLOCKER(cursor) cursor->locker->id
+#else
+#define CURSOR_SETLOCKER(cursor, id) cursor->locker = id
+#define CURSOR_GETLOCKER(cursor) cursor->locker
+#endif
+
#ifndef DB_BUFFER_SMALL
#define DB_BUFFER_SMALL ENOMEM
#endif
rc = db->cursor( db, txn, &cursor, bdb->bi_db_opflags );
if ( rc ) return rc;
if ( !txn && locker ) {
- cursor->locker = locker;
+ CURSOR_SETLOCKER(cursor, locker);
}
data.ulen = sizeof(diskNode) + (SLAP_LDAPDN_MAXLEN * 2);
if ( rc ) return rc;
/* Use our own locker if needed */
- if ( !tid && locker )
- cursor->locker = locker;
+ if ( !tid && locker ) {
+ CURSOR_SETLOCKER( cursor, locker );
+ }
/* Get the nattrs / nvals counts first */
data.ulen = data.dlen = sizeof(buf);
"cursor failed: %s (%d)\n", db_strerror(rc), rc, 0 );
return rc;
}
- cursor->locker = locker;
+ CURSOR_SETLOCKER( cursor, locker );
} else {
cursor = *saved_cursor;
}
op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs;
- rc = bdb_cache_find_parent( &op, NULL, cursor->locker, id, &ei );
+ rc = bdb_cache_find_parent( &op, NULL, CURSOR_GETLOCKER(cursor), id, &ei );
if ( rc == LDAP_SUCCESS ) {
bdb_cache_entryinfo_unlock( ei );
e->e_private = ei;