Lines Matching refs:dbh

47     DBHashTable *dbh = sdbh_open_S (path, WRITE, 0);  in dbh_open()  local
48 return (dbh); in dbh_open()
56 DBHashTable *dbh = sdbh_open_S (path, READ, 0); in dbh_open_ro() local
57 return (dbh); in dbh_open_ro()
67 DBHashTable *dbh; in dbh_new() local
88 dbh = sdbh_create(path, *key_length, flags); in dbh_new()
89 if (!dbh){ in dbh_new()
95 dbh = sdbh_open_S (path, READ, flags); in dbh_new()
97 dbh = sdbh_open_S (path, WRITE, flags); in dbh_new()
101 if (!dbh) { in dbh_new()
119 if (key_length) *key_length = DBH_KEYLENGTH(dbh); in dbh_new()
122 dbh->mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); in dbh_new()
123 if (dbh->mutex == NULL) { in dbh_new()
124 dbh_close(dbh); in dbh_new()
132 pthread_mutex_init(dbh->mutex, &attr); in dbh_new()
135 dbh->protection_flags = flags & (DBH_THREAD_SAFE|DBH_PARALLEL_SAFE|DBH_READ_ONLY); in dbh_new()
137 return dbh; in dbh_new()
142 int dbh_close (DBHashTable * dbh) { in dbh_close() argument
144 if(dbh == NULL) { in dbh_close()
148 if (dbh->protection_flags & DBH_THREAD_SAFE) pthread_mutex_lock(&new_mutex); in dbh_close()
150 if(dbh->head_info && dbh->head_info->writeOK){ sdbh_writeheader (dbh, 1); } in dbh_close()
154 if (dbh->fd >= 0){ in dbh_close()
156 fsync(dbh->fd); in dbh_close()
159 FlushFileBuffers ((HANDLE) _get_osfhandle (dbh->fd)); in dbh_close()
162 if(close (dbh->fd) < 0) { in dbh_close()
163 ERR( "close(%d): %s\n", dbh->fd, strerror (errno)); in dbh_close()
167 if (dbh->data) free (dbh->data); in dbh_close()
168 if (dbh->newdata) free (dbh->newdata); in dbh_close()
169 if (dbh->branch) free (dbh->branch); in dbh_close()
170 if (dbh->newbranch) free (dbh->newbranch); in dbh_close()
171 if (dbh->key) free (dbh->key); in dbh_close()
172 if (dbh->newkey) free (dbh->newkey); in dbh_close()
173 if (dbh->head_info) free (dbh->head_info); in dbh_close()
175 if (dbh->sem) { in dbh_close()
176 if (dbh->protection_flags & DBH_PARALLEL_SAFE) { in dbh_close()
177 if (dbh->lock_attempt_limit == 0) sem_wait(dbh->sem); in dbh_close()
180 timeout.tv_sec = time(NULL) + dbh->lock_attempt_limit; in dbh_close()
182 if (sem_timedwait(dbh->sem, &timeout) < 0){ in dbh_close()
183 …ose() unable to unlock semaphore for %s (%s), proceeding on timeout...\n", dbh->path, strerror(err… in dbh_close()
187 destroy_shm_lock(dbh->path, dbh->lock_p); in dbh_close()
188 sem_post(dbh->sem); in dbh_close()
189 sem_close(dbh->sem); in dbh_close()
193 char *s_name=sem_name(dbh->path); in dbh_close()
201 if (dbh->protection_flags & DBH_THREAD_SAFE) { in dbh_close()
202 if (dbh->mutex == NULL){ in dbh_close()
205 pthread_mutex_destroy(dbh->mutex); in dbh_close()
206 free(dbh->mutex); in dbh_close()
209 if (dbh->path) free (dbh->path); in dbh_close()
210 if (dbh->tmpdir) free (dbh->tmpdir); in dbh_close()
211 if (dbh->protection_flags & DBH_THREAD_SAFE) pthread_mutex_unlock(&new_mutex); in dbh_close()
212 free (dbh); in dbh_close()
216 int dbh_destroy (DBHashTable * dbh) { in dbh_destroy() argument
218 if(!dbh) { in dbh_destroy()
224 file = (char *)malloc (strlen (dbh->path) + 1); in dbh_destroy()
226 DBG( "malloc (%ld): %s\n", (long)(strlen (dbh->path) + 1),strerror(errno)); in dbh_destroy()
229 strcpy (file, dbh->path); in dbh_destroy()
230 dbh_close (dbh); in dbh_destroy()
241 int dbh_set_size (DBHashTable * dbh, FILE_POINTER record_length) { in dbh_set_size() argument
242 int s = sdbh_size (dbh, record_length); in dbh_set_size()
246 void dbh_set_recordsize (DBHashTable * dbh, int size) { in dbh_set_recordsize() argument
247 if(!dbh) { in dbh_set_recordsize()
252 dbh->bytes_userdata = size; in dbh_set_recordsize()
256 void dbh_set_data (DBHashTable * dbh, void *data, FILE_POINTER n) { in dbh_set_data() argument
257 if(!dbh || !data) { in dbh_set_data()
262 if(n > DBH_MAXIMUM_RECORD_SIZE(dbh)) { in dbh_set_data()
265 dbh_set_size (dbh, n); in dbh_set_data()
267 memcpy ((void *)dbh->data, (void *)data, n); in dbh_set_data()
268 dbh->bytes_userdata = n; in dbh_set_data()
272 void dbh_set_key (DBHashTable * dbh, unsigned char *key) { in dbh_set_key() argument
273 if(!dbh || !key) { in dbh_set_key()
278 memcpy ((void *)dbh->key, (void *)key, dbh->head_info->n_limit); in dbh_set_key()
282 FILE_POINTER dbh_update (DBHashTable * dbh) { in dbh_update() argument
285 if(dbh == NULL){ in dbh_update()
290 if(!(dbh->head_info->writeOK)){ in dbh_update()
299 dbh_lock_write (dbh); in dbh_update()
308 dbh->head_info->reservedC = 0; in dbh_update()
310 if(sdbh_locate (dbh, fp) == NULL){ in dbh_update()
315 if(dbh->newbytes_userdata < dbh->bytes_userdata) { in dbh_update()
328 dbh->flag = 0; in dbh_update()
333 for(i = 0; i < dbh->head_info->n_limit; i++) in dbh_update()
334 dbh->branch[i] = 0; in dbh_update()
335 CURRENTSEEK = place_eof (dbh); in dbh_update()
338 dbh_unlock_write (dbh); in dbh_update()
341 dbh->newbranches -= (unsigned char)CURR_BRANCH; in dbh_update()
342 dbh->head_info->data_space += dbh->bytes_userdata; in dbh_update()
343dbh->head_info->total_space += (dbh->bytes_userdata + sizeof (FILE_POINTER) * dbh->newbranches + 1… in dbh_update()
344 if(!sdbh_write (OLD, dbh, WRITEBRANCHES)){ in dbh_update()
345 dbh_unlock_write (dbh); in dbh_update()
348 if(!sdbh_readBranches (dbh, LASTSEEK)){ in dbh_update()
349 dbh_unlock_write (dbh); in dbh_update()
352 dbh->newbranch[CURR_BRANCH] = CURRENTSEEK; in dbh_update()
353 sdbh_updateBranch (dbh, LASTSEEK); in dbh_update()
354 dbh->head_info->records++; in dbh_update()
357 dbh->head_info->erased_space += (dbh->newbytes_userdata - dbh->bytes_userdata); in dbh_update()
358 dbh->head_info->data_space -= (dbh->newbytes_userdata - dbh->bytes_userdata); in dbh_update()
359 if(!place_fp_at (dbh, (off_t)CURRENTSEEK)){ in dbh_update()
360 dbh_unlock_write (dbh); in dbh_update()
363 if(!sdbh_write (OLD, dbh, DONTWRITEBRANCHES)) { in dbh_update()
364 dbh_unlock_write (dbh); in dbh_update()
372 dbh->head_info->erased_space += (dbh->newbytes_userdata); in dbh_update()
373 dbh->head_info->data_space += (dbh->bytes_userdata - dbh->newbytes_userdata); in dbh_update()
374dbh->head_info->total_space += (dbh->bytes_userdata + sizeof (FILE_POINTER) * dbh->newbranches + 1… in dbh_update()
375 FILE_POINTER eof = place_eof (dbh); in dbh_update()
377 dbh_unlock_write (dbh); in dbh_update()
380 dbh->head_info->bof = eof; in dbh_update()
381 if(!sdbh_write (NEW, dbh, WRITEBRANCHES)) { in dbh_update()
382 dbh_unlock_write (dbh); in dbh_update()
390 dbh->head_info->erased_space += (dbh->newbytes_userdata); in dbh_update()
391 dbh->head_info->data_space += (dbh->bytes_userdata - dbh->newbytes_userdata); in dbh_update()
392 dbh->head_info->total_space += in dbh_update()
393 … (dbh->bytes_userdata + sizeof (FILE_POINTER) * dbh->newbranches + 1 + sizeof (FILE_POINTER)); in dbh_update()
394 CURRENTSEEK = place_eof (dbh); in dbh_update()
396 dbh_unlock_write (dbh); in dbh_update()
399 j = dbh->newbranches; in dbh_update()
400 if(!sdbh_write (NEW, dbh, WRITEBRANCHES)) { in dbh_update()
401 dbh_unlock_write (dbh); in dbh_update()
404 ramas = sdbh_readBranches (dbh, LASTSEEK); in dbh_update()
406 dbh_unlock_write (dbh); in dbh_update()
409 dbh->newbranch[ramas - j + CURR_BRANCH] = CURRENTSEEK; in dbh_update()
410 sdbh_updateBranch (dbh, LASTSEEK); in dbh_update()
415 for(i = 0; i < dbh->head_info->n_limit; i++) in dbh_update()
416 dbh->branch[i] = 0; in dbh_update()
417 CURRENTSEEK = dbh->head_info->bof; in dbh_update()
418 if(!place_fp_at (dbh, (off_t)CURRENTSEEK)) { in dbh_update()
419 dbh_unlock_write (dbh); in dbh_update()
422 dbh->newbranches = dbh->head_info->n_limit; in dbh_update()
423 dbh->head_info->data_space += dbh->bytes_userdata; in dbh_update()
424dbh->head_info->total_space += (dbh->bytes_userdata + sizeof (FILE_POINTER) * dbh->newbranches + 1… in dbh_update()
425 if(!sdbh_write (OLD, dbh, WRITEBRANCHES)) { in dbh_update()
426 dbh_unlock_write (dbh); in dbh_update()
429 dbh->head_info->records++; in dbh_update()
434 sdbh_writeheader(dbh, flush_dbh); in dbh_update()
435 dbh_unlock_write (dbh); in dbh_update()
439 FILE_POINTER dbh_load (DBHashTable * dbh) { in dbh_load() argument
444 if(dbh == NULL){ in dbh_load()
447 dbh_lock_write (dbh); in dbh_load()
454 if(sdbh_locate (dbh, fp) == NULL){ in dbh_load()
455 dbh_unlock_write (dbh); in dbh_load()
458 dbh->reservedB = CURRENTSEEK; in dbh_load()
460 dbh_unlock_write (dbh); in dbh_load()
466 dbh->bytes_userdata = dbh->newbytes_userdata; in dbh_load()
467 dbh->branches = dbh->newbranches; in dbh_load()
468 tmp1 = dbh->key; in dbh_load()
469 tmp2 = dbh->newkey; in dbh_load()
470 for(j = 0; j < dbh->head_info->n_limit; j++) in dbh_load()
472 tmp1 = (unsigned char *)dbh->data; in dbh_load()
473 tmp2 = (unsigned char *)dbh->newdata; in dbh_load()
474 for(i = 0; i < dbh->newbytes_userdata; i++) in dbh_load()
479 dbh_unlock_write (dbh); in dbh_load()
483 dbh_unlock_write (dbh); in dbh_load()
503 FILE_POINTER dbh_find_top (DBHashTable * dbh, int n) { in dbh_find_top() argument
505 if(dbh == NULL) in dbh_find_top()
507 dbh_lock_write (dbh); in dbh_find_top()
509 if(sdbh_locateTop (dbh, fp, n) == NULL){ in dbh_find_top()
510 dbh_unlock_write (dbh); in dbh_find_top()
514 dbh_unlock_write (dbh); in dbh_find_top()
517 dbh->bytes_userdata = dbh->newbytes_userdata; in dbh_find_top()
518 dbh->branches = dbh->newbranches; in dbh_find_top()
520 dbh_unlock_write (dbh); in dbh_find_top()
524 FILE_POINTER dbh_find (DBHashTable * dbh, int n) { in dbh_find() argument
526 if(dbh == NULL) in dbh_find()
528 dbh_lock_write (dbh); in dbh_find()
530 if(sdbh_locateFind (dbh, fp, n) == NULL){ in dbh_find()
531 dbh_unlock_write (dbh); in dbh_find()
535 dbh_unlock_write (dbh); in dbh_find()
538 dbh->bytes_userdata = dbh->newbytes_userdata; in dbh_find()
539 dbh->branches = dbh->newbranches; in dbh_find()
541 dbh_unlock_write (dbh); in dbh_find()
545 unsigned char dbh_load_address (DBHashTable * dbh, FILE_POINTER currentseek) { in dbh_load_address() argument
548 if(dbh == NULL) in dbh_load_address()
553 dbh_lock_write (dbh); in dbh_load_address()
554 dbh->reservedB = currentseek; in dbh_load_address()
555 for(i = 1; i <= dbh->head_info->n_limit; i++) in dbh_load_address()
556 dbh->branch[i - 1] = 0; in dbh_load_address()
557 if(!place_fp_at (dbh, (off_t)currentseek)) { in dbh_load_address()
558 dbh_unlock_write (dbh); in dbh_load_address()
561 if(!sdbh_read (OLD, dbh, 1)) { in dbh_load_address()
562 dbh_unlock_write (dbh); in dbh_load_address()
565 unsigned char b = dbh->branches; in dbh_load_address()
566 dbh_unlock_write (dbh); in dbh_load_address()
570 FILE_POINTER dbh_load_parent (DBHashTable * dbh) { in dbh_load_parent() argument
572 if(dbh == NULL) in dbh_load_parent()
574 dbh_lock_write (dbh); in dbh_load_parent()
575 if(sdbh_locate (dbh, fp) == NULL){ in dbh_load_parent()
576 dbh_unlock_write (dbh); in dbh_load_parent()
580 dbh_unlock_write (dbh); in dbh_load_parent()
583 FILE_POINTER address = dbh_load_address (dbh, LASTSEEK); in dbh_load_parent()
584 dbh_unlock_write (dbh); in dbh_load_parent()
588 FILE_POINTER dbh_load_child (DBHashTable * dbh, unsigned char key_index) { in dbh_load_child() argument
590 if(dbh == NULL) in dbh_load_child()
592 dbh_lock_write (dbh); in dbh_load_child()
593 if(sdbh_locate (dbh, fp) == NULL){ in dbh_load_child()
594 dbh_unlock_write (dbh); in dbh_load_child()
598 dbh_unlock_write (dbh); in dbh_load_child()
601 if(key_index >= dbh->newbranches){ in dbh_load_child()
602 dbh_unlock_write (dbh); in dbh_load_child()
605 child_address = *(dbh->newbranch + key_index); in dbh_load_child()
606 FILE_POINTER p = dbh_load_address (dbh, child_address); in dbh_load_child()
607 dbh_unlock_write (dbh); in dbh_load_child()
611 int dbh_erase (DBHashTable * dbh) { in dbh_erase() argument
612 if(dbh == NULL) return 0; in dbh_erase()
613 if(!(dbh->head_info->writeOK)){ in dbh_erase()
620 dbh_lock_write (dbh); in dbh_erase()
621 currentseek = dbh_load (dbh); in dbh_erase()
627 if(!place_fp_at (dbh, (off_t)currentseek + 1)) { in dbh_erase()
628 dbh_unlock_write (dbh); in dbh_erase()
633 if(write (dbh->fd, &(dbh->flag), 1) != 1) { in dbh_erase()
634 dbh_unlock_write (dbh); in dbh_erase()
638 dbh->head_info->data_space -= dbh->bytes_userdata; in dbh_erase()
639 dbh->head_info->erased_space += (dbh->bytes_userdata); in dbh_erase()
640 sdbh_writeheader (dbh, 1); in dbh_erase()
641 dbh_unlock_write (dbh); in dbh_erase()
645 int dbh_unerase (DBHashTable * dbh) { in dbh_unerase() argument
646 if(dbh == NULL) return 0; in dbh_unerase()
647 if(!(dbh->head_info->writeOK)){ in dbh_unerase()
653 dbh_lock_write (dbh); in dbh_unerase()
655 if(sdbh_locate (dbh, fp) == NULL){ in dbh_unerase()
656 dbh_unlock_write (dbh); in dbh_unerase()
662 dbh_unlock_write (dbh); in dbh_unerase()
666 dbh_load_address (dbh, currentseek); /* found currentseek, now load it */ in dbh_unerase()
668 dbh_unlock_write (dbh); in dbh_unerase()
673 if(!place_fp_at (dbh, (off_t)currentseek + 1)) { in dbh_unerase()
674 dbh_unlock_write (dbh); in dbh_unerase()
678 if(write (dbh->fd, &(dbh->flag), 1) != 1) { in dbh_unerase()
679 dbh_unlock_write (dbh); in dbh_unerase()
683 dbh->head_info->data_space += dbh->bytes_userdata; in dbh_unerase()
684 dbh->head_info->erased_space -= (dbh->bytes_userdata); in dbh_unerase()
685 sdbh_writeheader (dbh, 1); in dbh_unerase()
686 dbh_unlock_write (dbh); in dbh_unerase()
690 int dbh_prune (DBHashTable * dbh, unsigned char *key, unsigned char subtree_length) { in dbh_prune() argument
691 if(!(dbh->head_info->writeOK)){ in dbh_prune()
697 dbh_lock_write (dbh); in dbh_prune()
698 dbh->head_info->sweep_erased = 1; in dbh_prune()
699 result = dbh_sweep (dbh, prune_mark_erased, key, NULL, subtree_length); in dbh_prune()
700 dbh->head_info->sweep_erased = 0; in dbh_prune()
702 sdbh_writeheader (dbh, 1); in dbh_prune()
703 dbh_unlock_write (dbh); in dbh_prune()
707 int dbh_unprune (DBHashTable * dbh, unsigned char *key, unsigned char subtree_length) { in dbh_unprune() argument
708 if(!(dbh->head_info->writeOK)){ in dbh_unprune()
714 dbh_lock_write (dbh); in dbh_unprune()
715 dbh->head_info->sweep_erased = 1; in dbh_unprune()
716 result = dbh_sweep (dbh, prune_mark_unerased, key, NULL, subtree_length); in dbh_unprune()
717 dbh->head_info->sweep_erased = 0; in dbh_unprune()
719 sdbh_writeheader (dbh, 1); in dbh_unprune()
720 dbh_unlock_write (dbh); in dbh_unprune()
724 int dbh_foreach (DBHashTable * dbh, DBHashFunc2 operate, void *data) { in dbh_foreach() argument
725 dbh_lock_write(dbh); in dbh_foreach()
726 dbh->head_info->dbh_exit = 0; in dbh_foreach()
727 int r = sdbh_newbarre2 (dbh, operate, data); in dbh_foreach()
728 dbh_unlock_write (dbh); in dbh_foreach()
732 int dbh_foreach_sweep (DBHashTable * dbh, DBHashFunc operate) { in dbh_foreach_sweep() argument
733 dbh_lock_write(dbh); in dbh_foreach_sweep()
734 dbh->head_info->dbh_exit = 0; in dbh_foreach_sweep()
736 dbh->operate = operate; in dbh_foreach_sweep()
737 int r = sdbh_newbarre (dbh, NULL, NULL, 0); in dbh_foreach_sweep()
738 dbh_unlock_write (dbh); in dbh_foreach_sweep()
742 int dbh_foreach_fanout (DBHashTable * dbh, DBHashFunc operate) { in dbh_foreach_fanout() argument
743 dbh_lock_write(dbh); in dbh_foreach_fanout()
744 dbh->head_info->dbh_exit = 0; in dbh_foreach_fanout()
746 dbh->operate = operate; in dbh_foreach_fanout()
747 int r = sdbh_newreversebarre (dbh, NULL, NULL, 0); in dbh_foreach_fanout()
748 dbh_unlock_write(dbh); in dbh_foreach_fanout()
752 int dbh_sweep (DBHashTable * dbh, DBHashFunc operate, unsigned char *key1, unsigned char *key2, uns… in dbh_sweep() argument
753 if(!dbh) in dbh_sweep()
755 dbh_lock_write(dbh); in dbh_sweep()
757 dbh->operate = operate; in dbh_sweep()
758 int r = sdbh_newbarre (dbh, key1, key2, ignore_portion); in dbh_sweep()
759 dbh_unlock_write(dbh); in dbh_sweep()
763 int dbh_fanout (DBHashTable * dbh, DBHashFunc operate, unsigned char *key1, unsigned char *key2, un… in dbh_fanout() argument
764 if(!dbh) in dbh_fanout()
766 dbh_lock_write(dbh); in dbh_fanout()
768 dbh->operate = operate; in dbh_fanout()
769 int r = sdbh_newreversebarre (dbh, key1, key2, ignore_portion); in dbh_fanout()
770 dbh_unlock_write(dbh); in dbh_fanout()
774 void dbh_exit_sweep (DBHashTable * dbh) { in dbh_exit_sweep() argument
775 if(!dbh) { in dbh_exit_sweep()
781 dbh->head_info->dbh_exit = 1; in dbh_exit_sweep()
785 void dbh_exit_fanout (DBHashTable * dbh) { in dbh_exit_fanout() argument
786 dbh_exit_sweep (dbh); in dbh_exit_fanout()
791 int dbh_writeheader (DBHashTable * dbh) { in dbh_writeheader() argument
792 return sdbh_writeheader(dbh, 1); in dbh_writeheader()
872 int dbh_settempdir (DBHashTable * dbh, char *dir) { in dbh_settempdir() argument
874 dbh->head_info->user_tmpdir = 0; in dbh_settempdir()
875 if(dbh->tmpdir) in dbh_settempdir()
876 free (dbh->tmpdir); in dbh_settempdir()
877 dbh->tmpdir = NULL; in dbh_settempdir()
880 if(dbh->tmpdir) in dbh_settempdir()
881 free (dbh->tmpdir); in dbh_settempdir()
882 dbh->tmpdir = (char *)malloc (strlen (dir) + 1); in dbh_settempdir()
883 if (!dbh->tmpdir){ in dbh_settempdir()
887 strcpy (dbh->tmpdir, dir); in dbh_settempdir()
888 dbh->head_info->user_tmpdir = 1; in dbh_settempdir()
892 int dbh_mutex_lock(DBHashTable * dbh){ in dbh_mutex_lock() argument
893 if (!dbh) return 0; in dbh_mutex_lock()
894 if (!dbh->mutex){ in dbh_mutex_lock()
899 pthread_mutex_lock(dbh->mutex); in dbh_mutex_lock()
903 int dbh_mutex_unlock(DBHashTable * dbh){ in dbh_mutex_unlock() argument
904 if (!dbh) return 0; in dbh_mutex_unlock()
905 if (!dbh->mutex){ in dbh_mutex_unlock()
910 pthread_mutex_unlock(dbh->mutex); in dbh_mutex_unlock()
915 int dbh_set_parallel_lock_attempt_limit(DBHashTable * dbh, int limit){ in dbh_set_parallel_lock_attempt_limit() argument
916 if (!dbh) return 0; in dbh_set_parallel_lock_attempt_limit()
917 dbh->lock_attempt_limit = limit; in dbh_set_parallel_lock_attempt_limit()
922 int dbh_set_parallel_lock_timeout(DBHashTable * dbh, int seconds){ in dbh_set_parallel_lock_timeout() argument
923 if (!dbh) return 0; in dbh_set_parallel_lock_timeout()
924 dbh->lock_attempt_limit = seconds; in dbh_set_parallel_lock_timeout()
928 int dbh_clear_locks(DBHashTable * dbh){ in dbh_clear_locks() argument
933 if (!dbh || !dbh->path) { in dbh_clear_locks()
937 if (!(dbh->protection_flags & DBH_PARALLEL_SAFE)){ in dbh_clear_locks()
940 if (dbh->lock_attempt_limit == 0) sem_wait(dbh->sem); in dbh_clear_locks()
943 timeout.tv_sec = time(NULL) + dbh->lock_attempt_limit; in dbh_clear_locks()
945 if (sem_timedwait(dbh->sem, &timeout) < 0){ in dbh_clear_locks()
946 …cks() unable to unlock semaphore for %s (%s), proceeding on timeout...\n", dbh->path, strerror(err… in dbh_clear_locks()
949 dbh->lock_p->write_lock_count = 0; in dbh_clear_locks()
950 dbh->lock_p->write_lock = 0; in dbh_clear_locks()
951 dbh->lock_p->read_lock_count = 0; in dbh_clear_locks()
953 if(msync (dbh->lock_p, sizeof(dbh_lock_t), MS_ASYNC|MS_INVALIDATE) < 0){ in dbh_clear_locks()
955 dbh->path, strerror (errno)); in dbh_clear_locks()
957 sem_post(dbh->sem); in dbh_clear_locks()
963 dbh_lock_write (DBHashTable * dbh) { in dbh_lock_write() argument
968 return sdbh_lock(dbh, 1); in dbh_lock_write()
973 dbh_lock_read (DBHashTable * dbh) { in dbh_lock_read() argument
978 return sdbh_lock(dbh, 0); in dbh_lock_read()
983 dbh_unlock_read (DBHashTable * dbh) { in dbh_unlock_read() argument
988 return sdbh_unlock(dbh, 0); in dbh_unlock_read()
993 dbh_unlock_write (DBHashTable * dbh) { in dbh_unlock_write() argument
998 return sdbh_unlock(dbh, 1); in dbh_unlock_write()
1014 int dbh_info (DBHashTable * dbh) { in dbh_info() argument
1015 if(!dbh) { in dbh_info()
1021 dbh_lock_read (dbh); in dbh_info()
1022 FILE_POINTER eof = place_eof (dbh); in dbh_info()
1024 dbh_unlock_read (dbh); in dbh_info()
1041dbh->head_info->version, DBH_KEYLENGTH (dbh), (long)dbh->head_info->bof, (long)DBH_MAXIMUM_RECORD_… in dbh_info()
1042 dbh_unlock_read (dbh); in dbh_info()