-void bt_latchaudit (BtDb *bt)
-{
-ushort idx, hashidx;
-BtLatchSet *set;
-BtPool *pool;
-BtPage page;
-uid page_no;
-
-#ifdef unix
- for( idx = 1; idx < bt->mgr->latchmgr->latchdeployed; idx++ ) {
- set = bt->mgr->latchsets + idx;
- if( *(ushort *)set->readwr || *(ushort *)set->access || *(ushort *)set->parent ) {
- fprintf(stderr, "latchset %d locked for page %6x\n", idx, set->page_no);
- *(ushort *)set->readwr = 0;
- *(ushort *)set->access = 0;
- *(ushort *)set->parent = 0;
- }
- if( set->pin ) {
- fprintf(stderr, "latchset %d pinned\n", idx);
- set->pin = 0;
- }
- }
-
- for( hashidx = 0; hashidx < bt->mgr->latchmgr->latchhash; hashidx++ ) {
- if( *(uint *)bt->mgr->latchmgr->table[hashidx].latch )
- fprintf(stderr, "latchmgr locked\n");
- if( idx = bt->mgr->latchmgr->table[hashidx].slot ) do {
- set = bt->mgr->latchsets + idx;
- if( *(uint *)set->readwr || *(ushort *)set->access || *(ushort *)set->parent )
- fprintf(stderr, "latchset %d locked\n", idx);
- if( set->hash != hashidx )
- fprintf(stderr, "latchset %d wrong hashidx\n", idx);
- if( set->pin )
- fprintf(stderr, "latchset %d pinned\n", idx);
- } while( idx = set->next );
- }
- page_no = bt_getid(bt->mgr->latchmgr->alloc[1].right);
-
- while( page_no ) {
- fprintf(stderr, "free: %.6x\n", (uint)page_no);
- pool = bt_pinpool (bt, page_no);
- page = bt_page (bt, pool, page_no);
- page_no = bt_getid(page->right);
- bt_unpinpool (pool);
- }
-#endif
-}
-