aboutsummaryrefslogtreecommitdiff
path: root/src/bucket.c
AgeCommit message (Collapse)AuthorFiles
2023-01-22Update copyright yearsSergey Poznyakoff1
2022-01-25Fix possible heap buffer overflowSergey Poznyakoff1
* src/bucket.c (_gdbm_split_bucket): When splitting the bucket, check if hash values are within allowed range.
2022-01-08BugfixesSergey Poznyakoff1
* src/bucket.c (_gdbm_cache_init): Accept sizes greater than the directory size. * src/gdbmsetopt.c (setopt_gdbm_getdbformat): Return 0 on success.
2022-01-07Minor fixSergey Poznyakoff1
* src/bucket.c (lru_unlink_elem): Take into account the possibility that dbf->cache_mru can be NULL.
2022-01-06Speed up flushing the bucket cache on diskSergey Poznyakoff1
The implementation of _gdbm_cache_flush becomes prohibitively inefficient during extensive updates of large databases. The bug was reported at https://github.com/Perl/perl5/issues/19306. To fix it, make sure that all changed cache entries are placed at the head of the cache_mru list, forming a contiguous sequence. This way a potentially long iteration over all cache entries can be cut off at the first entry with ca_changed == FALSE. This commit also gets rid of several superfluous fields in struct gdbm_file_info: - cache_entry Not needed, because the most recently used cache entry (cache_mru) is always the current one. - bucket_changed dbf->cache_mru->ca_changed reflects the status of the current bucket. - second_changed Not needed because _gdbm_cache_flush, which flushes all changed buckets, is now invoked unconditionally by _gdbm_end_update (and also whenever dbf->cache_mru changes). * src/gdbmdefs.h (struct gdbm_file_info): Remove cache_entry. The current cache entry is cache_mru. Remove bucket_changed, and second_changed. All uses changed. * src/proto.h (_gdbm_current_bucket_changed): New inline function. * src/bucket.c (_gdbm_cache_flush): Assume all changed elements form a contiguous sequence beginning with dbf->cache_mru. (set_cache_entry): Remove. All callers changed. (lru_link_elem,lru_unlink_elem): Update dbf->bucket as necessary. (cache_lookup): If the obtained bucket is not changed and is going to become current, flush all changed cache elements. * src/update.c (_gdbm_end_update): Call _gdbm_cache_flush unconditionally. * src/findkey.c: Use dbf->cache_mru instead of the removed dbf->cache_entry. * src/gdbmseq.c: Likewise. * tools/gdbmshell.c (_gdbm_print_bucket_cache): Likewise. * src/falloc.c: Use _gdbm_current_bucket_changed to mark the current bucket as changed. * src/gdbmstore.c: Likewise. * src/gdbmdelete.c: Likewise. Use _gdbm_current_bucket_changed. * tests/gtcacheopt.c: Fix typo. * tests/gtload.c: New option: -cachesize
2022-01-02Update copyright yearsSergey Poznyakoff1
2021-11-14Switch to hash table cache implementationSergey Poznyakoff1
* src/cachetree.c: Remove. * src/Makefile.am: Remove cachetree.c * doc/gdbm.texi: Document the changes. * src/bucket.c (cache_tab_lookup_slot) (cache_tab_resize): New function. (cache_elem_new): Initialize ca_coll. (cache_elem_free, cache_lookup) (_gdbm_cache_init,_gdbm_cache_free): Rewrite with hash-based cache lookup. (_gdbm_fetch_data): Remove unused function. * src/gdbm.h.in (GDBM_GETDBFORMAT, GDBM_GETDIRDEPTH) (GDBM_GETBUCKETSIZE, GDBM_GETCACHEAUTO, GDBM_SETCACHEAUTO): New option codes. * src/gdbmdefs.h (cache_node): Remove. (cache_elem): Remove ca_node. Add ca_coll (collision resolution pointer). (gdbm_file_info): New members: cache_auto, cache_bits, cache. * src/gdbmopen.c (gdbm_fd_open): Change cache initialization. * src/gdbmsetopt.c (GDBM_GETDBFORMAT,GDBM_GETDIRDEPTH) (GDBM_GETBUCKETSIZE,GDBM_GETCACHEAUTO) (GDBM_SETCACHEAUTO): Implement new options. (setopt_gdbm_getflags): Reflect the state of GDBM_CLOEXEC and GDBM_NUMSYNC. * src/proto.h (_gdbm_fetch_data,_gdbm_cache_tree_alloc) (_gdbm_cache_tree_destroy,_gdbm_cache_tree_delete) (_gdbm_cache_tree_lookup): Remove protos. * src/recover.c (_gdbm_finish_transfer): Restore original cache settings. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise. * tests/gtcacheopt.c: New file. * tests/setopt02.at: New test case.
2021-09-19Fix key verification in sequential access.Sergey Poznyakoff1
This fixes https://oss-fuzz.com/testcase-detail/6317999997452288 and improves 4046a0af. * src/bucket.c (gdbm_dir_entry_valid_p): Move to proto. * src/proto.h (gdbm_dir_entry_valid_p): New inline function. * src/gdbmseq.c (gdbm_valid_key_p): Use gdbm_dir_entry_valid_p to validate the buffer index. Reorder the checks.
2021-03-21Enable automatic cache size by default.newcacheSergey Poznyakoff1
This provides for the optimal performance. Additional GDBM_XVERIFY flag can be used when opening the database to request extended database verification (entire avail stack will be checked). * src/bucket.c (cache_lookup): Handle cache_size == GDBM_CACHE_AUTO. (_gdbm_cache_init): Likewise. * src/gdbm.h.in (GDBM_XVERIFY): New flag to gdbm_open. (GDBM_CACHE_AUTO): New constant. Define error constants within enum. Fix definition of GDBM_BAD_HASH_ENTRY. * src/gdbmclose.c: Fix misleading comment. * src/gdbmconst.h: Define DEFAULT_CACHESIZE to be GDBM_CACHE_AUTO. * src/gdbmopen.c (gdbm_fd_open): Call gdbm_avail_verify if the GDBM_XVERIFY flag is set. * doc/gdbm.texi: Update. * doc/gdbm.3: Update.
2021-03-20More optimizations in cache treeSergey Poznyakoff1
* src/bucket.c (gdbm_dir_entry_valid_p): Inline (cache_lookup): Keep track of cache hits. (_gdbm_get_bucket): Check the cache_entry first. (gdbm_get_cache_stats): Change signature. Return the per-db number of cache hits as well. * src/cachetree.c: Inline static functions. (_gdbm_cache_tree_lookup): Avoid extra level of indirection (nodeptr) at the expense of one additional comparison. * src/gdbm.h.in (gdbm_get_cache_stats): Change signature. * src/gdbmdefs.h (gdbm_file_info) <cache_hits>: New member.
2021-01-02Update copyright yearsSergey Poznyakoff1
2020-10-31Recover from ENOMEM in cache_lookupSergey Poznyakoff1
* src/bucket.c (cache_lookup): Try to recover from ENOMEM by freeing the least recently used cache entry.
2020-10-29Minor changes.Sergey Poznyakoff1
* src/bucket.c (_gdbm_cache_init): Minimum cache capacity is 1. * src/cachetree.c (_gdbm_cache_tree_lookup): Fix the description. (_gdbm_cache_tree_destroy): Speed up the tree traversal. * src/gdbmsetopt.c (setopt_gdbm_setcachesize): Don't enforce minimal cache capacity.
2020-01-27Update copyright yearsSergey Poznyakoff1
2019-11-16Simplify memory allocationSergey Poznyakoff1
* src/gdbmdefs.h (cache_elem): Place one hash_bucket element at the end of the structure so it can be allocated along with it. * src/bucket.c (cache_elem_new): Allocate enough space for cache_elem and dbf->header->bucket_size hash bucket within.
2019-11-13Move cache element allocation to bucket.c.Sergey Poznyakoff1
* src/bucket.c (_gdbm_cache_elem_new): Rename to cache_elem_new. Make static. (cache_lookup): Allocate new elem if _gdbm_cache_tree_lookup returned node_new. * src/cachetree.c (cache_tree): Remove dbf. (_gdbm_cache_tree_delete): Use node->adr. (cache_tree_lookup): Rename to _gdbm_cache_tree_lookup. Change signature. Return pointer to the (found or inserted) node. Don't allocate elem, this is responsibility of the caller. (_gdbm_cache_tree_alloc): Change signature. * src/gdbmdefs.h (cache_node): New definition (from cachetree.c) * src/proto.h: Fix protos.
2019-11-13Namespace cleanupSergey Poznyakoff1
* src/proto.h (_gdbm_cache_tree_delete): Remove. (_gdbm_rbt_remove_node): Rename to _gdbm_cache_tree_delete. All uses changed
2019-11-12Rewrite bucket cacheSergey Poznyakoff1
The new bucket cache uses the least recently used replacement policy (instead of the least recently read, implemented previously). It also allows for quick bucket lookups by the corresponding disk address. To this effect the cache entries form a red-black tree sorted by bucket address. Additionally, data buckets are also cached. * README: Describe the new branch. * src/bucket.c: Rewrite cache support. * src/cachetree.c: New file. * src/Makefile.am: Add new file. * src/findkey.c (_gdbm_read_entry): Use _gdbm_fetch_data. This ensures data pages are cached as well as buckets. * src/gdbm.h.in (GDBM_BUCKET_CACHE_CORRUPTED): New error code. (gdbm_cache_stat): New struct. (gdbm_get_cache_stats): New proto. * src/gdbmclose.c (gdbm_close): Call _gdbm_cache_free to dispose of the cache. * src/gdbmdefs.h (cache_elem_color): New data type. (cache_elem): New members: ca_left, ca_right, ca_node, and ca_hits. (cache_tree): New typedef. (gdbm_file_info): Remove bucket_cache and last_read. New fields: cache_num, cache_tree, cache_mru, cache_lru, cache_avail, cache_access_count. * src/gdbmerrno.c: Handle GDBM_BUCKET_CACHE_CORRUPTED. * src/gdbmopen.c (gdbm_fd_open): Change cache initialization. (_gdbm_init_cache, _gdbm_cache_entry_invalidate: Remove. * src/gdbmsetopt.c (setopt_gdbm_setcachesize): Cache can be re-initialized on the fly. * src/gdbmtool.c: Change bucket printing routines. * src/proto.h (_gdbm_read_bucket_at): Remove. (_gdbm_fetch_data,_gdbm_cache_init,_gdbm_cache_free) (_gdbm_cache_flush,_gdbm_cache_elem_new) (_gdbm_cache_tree_alloc,_gdbm_cache_tree_destroy) (_gdbm_cache_tree_delete,_gdbm_rbt_remove_node) (_gdbm_cache_tree_lookup): New protos. (_gdbm_init_cache,_gdbm_cache_entry_invalidate): Remove. * src/recover.c (_gdbm_finish_transfer): Adapt to the new cache structure. * src/update.c: Likewise. * tests/setopt00.at: Fix second GDBM_SETCACHESIZE test.
2019-04-08Update copyright yearsSergey Poznyakoff1
2018-08-19Fix directory entry validation.Sergey Poznyakoff1
Bug reported by Miroslav Lichvar and Marek Skalický * src/bucket.c (gdbm_dir_entry_valid_p): Fix lower limit for the allowed bucket address. Initial allocation of second block for the directory can be eventually returned to the available list when the directory is expanded during bucket splitting.
2018-06-23Bugfixes. Consistently use the coalesce_blocks flag.Sergey Poznyakoff1
* src/bucket.c (_gdbm_split_bucket): Take into account coalesce_blocks * src/falloc.c (_gdbm_put_av_elem): Change to void return. All uses changed. * src/proto.h: Likewise.
2018-06-16Version 1.5v1.15Sergey Poznyakoff1
* configure.ac: Version 1.5 * NEWS: Update. * src/Makefile.am (VI_CURRENT): Increment to 6 * src/bucket.c (_gdbm_get_bucket): Fix the upper limit for bucket_bits. * src/falloc.c (push_avail_block): Fill the allocated block with 0s.
2018-05-30More error checkingSergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket): Check if bucket_bits value is valid. * src/gdbmtool.c (_gdbm_print_avail_list): Reverse the sense of the conditional (fix regression).
2018-05-30Namespace cleanupSergey Poznyakoff1
Rename: __read to gdbm_file_read __write to gdbm_file_write __lseek to gdbm_file_seek __fsync to gdbm_file_sync
2018-05-30Drop debugging hooksSergey Poznyakoff1
The hooks were introduced as a temporary tool in de7834e9. They did their job and are not necessary any more.
2018-05-30Fix memory leak in _gdbm_get_bucketSergey Poznyakoff1
2018-05-27Additional validation of avail_table.Sergey Poznyakoff1
Verify that avail_table is sorted by size and that each element's size falls within allowed range. * src/bucket.c (gdbm_get_bucket): Fix bucket validation. Validate bucket_avail. (_gdbm_split_bucket): Check return from _gdbm_free. * src/falloc.c (adjust_bucket_avail,_gdbm_free): Return error code. All uses updated. (pop_avail_block): Fix eventual memory leak. Use gdbm_avail_block_validate. * src/gdbmdefs.h (gdbm_avail_table_valid_p): Change signature. * src/gdbmopen.c (gdbm_avail_table_valid_p): Traverse the array verifying address and size of each element. (gdbm_avail_block_validate) (gdbm_bucket_avail_table_validate): New functions. (validate_header): Remove call to gdbm_avail_block_valid_p. Avail_block is validated later, after it's been loaded. Bail out if header->next_block does not equal the file size. (gdbm_fd_open): Validate avail_block. * src/gdbmstore.c (_gdbm_store): Check return from _gdbm_free. Avoid endless loop in case of inconsistent h_table. * src/gdbmtool.c (_gdbm_print_avail_list): Use gdbm_avail_block_validate. * src/proto.h: Update. * tests/gtload.c: Improve error diagnostics.
2018-05-25More database consistency checksSergey Poznyakoff1
* NEWS: Update. * THANKS: Update. * src/bucket.c (_gdbm_get_bucket): Check if directory entry is valid. Don't cache invalid buckets. * src/gdbm.h.in (GDBM_BAD_DIR_ENTRY): New error code. * src/gdbmerrno.c: Likewise. * src/gdbmopen.c (validate_header): Compute expected number of bucket elements based on the bucket size, not on the block size. (_gdbm_init_cache_entry): New function. * src/proto.h (_gdbm_init_cache_entry): New proto. * src/recover.c (gdbm_recover): Clear error state after return from check_db indicating failure.
2018-05-19Improve error checkingSergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket): Improve validation. * src/fullio.c (_gdbm_full_read,_gdbm_full_write): Don't overwrite an already set error. * src/gdbm.h.in (GDBM_WRONG_OFF_T): Merge with GDBM_BAD_FILE_OFFSET. (GDBM_BAD_HEADER): New error code. * src/gdbmdump.c (_gdbm_dump_ascii): Check for database error code. * src/gdbmerrno.c (gdbm_errlist): Add GDBM_BAD_HEADER * src/gdbmopen.c (validate_header: Imporve logic. (_gdbm_init_cache): Initialize bucket_cache * src/gdbmseq.c (gdbm_firstkey): Check return value from _gdbm_get_bucket. * src/mmap.c (_gdbm_mapped_remap): Bail out if current position is bigger than file size.
2018-05-16Improve database file safety checks.Sergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket): Verify bucket consistency. * src/gdbm.h.in (GDBM_BAD_BUCKET, GDBM_WRONG_ARCH): New error codes. * src/gdbmerrno.c (gdbm_errlist): New error codes. * src/gdbmopen.c (gdbm_fd_open): Improve header consistency checks.
2018-01-01Happy GNU YearSergey Poznyakoff1
2017-01-02Happy GNU YearSergey Poznyakoff1
2016-07-27Remove obsolete error code.Sergey Poznyakoff1
* doc/gdbm.texi: Remove description of GDBM_UNKNOWN_UPDATE. Document GDBM_DIR_OVERFLOW. * src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): Rename to GDBM_DIR_OVERFLOW. (GDBM_UNKNOWN_ERROR): New error code. (GDBM_UNKNOWN_UPDATE): Define to GDBM_UNKNOWN_ERROR for backward compatibility. * src/gdbmerrno.c (gdbm_strerror, gdbm_db_strerror): Simplify a bit
2016-07-27Avoid range error when doubling directory size.Sergey Poznyakoff1
* src/bucket.c (_gdbm_split_bucket): Avoid range error when doubling directory size. * src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): New error code. * src/gdbmerrno.c (gdbm_errlist): Describe GDBM_ERR_DIR_OVERFLOW.
2016-07-26Minor changesSergey Poznyakoff1
* src/bucket.c (_gdbm_read_bucket_at): Remove unused variable. * src/debug.c: Include ctype.h (datbuf_format): Don't use sprintf; Precede each output line with data offset.
2016-07-26Fix remaining uses of gdbm_set_errno function.Sergey Poznyakoff1
Use the GDBM_SET_ERRNO and GDBM_SET_ERRNO2 macros to make sure the error gets reported in debug output. * src/fullio.c (_gdbm_full_read) (_gdbm_full_write): Return -1 and set gdbm_errno on error. * src/bucket.c: Use GDBM_SET_ERRNO(2?) or GDBM_DEBUG where necessary. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbmdefs.h: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmstore.c: Likewise. * src/mmap.c: Likewise. * src/recover.c: Likewise. * src/update.c: Likewise.
2016-07-25Improve debugging and error tracing.Sergey Poznyakoff1
* src/gdbmdefs.h (GDBM_SET_ERRNO) (GDBM_SET_ERRNO2): New macros. * src/base64.c: Use new macros to set error state. * src/bucket.c: Likewise. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmtool.c: Fix preprocessor conditional.
2016-07-20Introduce debug hooks.Sergey Poznyakoff1
* configure.ac: New option --enable-debug Print feature summary at the end of the run. * src/debug.c: New file. * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Build debug.o Define GDBM_DEBUG_ENABLE. * src/gdbmdefs.h [GDBM_DEBUG_ENABLE] (_gdbm_debug_hook_install) (_gdbm_debug_hook_remove,_gdbm_debug_hook_check) (_gdbm_debug_hook_val): New protos. (GDBM_DEBUG_HOOK, GDBM_DEBUG_OVERRIDE) (GDBM_DEBUG_ALLOC): New defines. * src/gdbm.h.in (GDBM_RCVR_FORCE): New flag. * src/recover.c (gdbm_recover): Check database before attempting recovery, unless GDBM_RCVR_FORCE flag is set. * doc/gdbm.texi: Document GDBM_RCVR_FORCE * src/gdbmreorg.c (gdbm_reorganize): Use GDBM_RCVR_FORCE. * src/gdbmtool.c (main): Always allocate file_name. * src/bucket.c: Put GDBM_DEBUG_OVERRIDE and GDBM_DEBUG_ALLOC in critical places. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmstore.c: Likewise. * src/update.c: Likewise. * tests/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Define GDBM_DEBUG_ENABLE. * tests/gtload.c: New options -hook, -recover, -verbose, -backup, -max-failures, -max-failed-keys, and -max-failed-buckets. Attempt recovery after errors.
2016-07-19Implement gdbm_recover functionSergey Poznyakoff1
* configure.ac: Don't check for rename. * src/Makefile.am (libgdbm_la_SOURCES): Add recover.c * src/recover.c: New file. * src/bucket.c (_gdbm_get_bucket): Remove extra space before [ * src/err.c (prerror): Take additional argument (gdbm_perror): Print system errno if necessary. * src/gdbm.h.in (GDBM_CLOERROR): New flag. (gdbm_fd_open, gdbm_copy_meta): New proto. (gdbm_last_syserr,gdbm_db_strerror,gdbm_recover): New proto. (gdbm_syserr): New extern. (gdbm_recovery): New struct. (GDBM_RCVR_DEFAULT,GDBM_RCVR_ERRFUN) (GDBM_RCVR_MAX_FAILED_KEYS) (GDBM_RCVR_MAX_FAILED_BUCKETS) (GDBM_RCVR_MAX_FAILURES) (GDBM_RCVR_BACKUP): New flags. (GDBM_BACKUP_FAILED): New error code. * src/gdbmclose.c (gdbm_close): Work correctly if dbf->desc == -1. * src/gdbmcount.c (gdbm_count): Remove spurious sorting. Use _gdbm_next_bucket_dir for iterating over the buckets. * src/gdbmdefs.h (struct gdbm_file_info)<last_syserror> <last_errstr>: New members. * src/gdbmerrno.c (gdbm_set_errno): Set last_syserror as well. (gdbm_clear_error): Reset last_syserror. (gdbm_last_syserr): New function. (gdbm_errlist): New entry for GDBM_BACKUP_FAILED. (gdbm_db_strerror): New function. (gdbm_syserr): New global. * src/gdbmload.c (get_parms): Buffer can be NULL. * src/gdbmopen.c (gdbm_fd_open): New function. (gdbm_open): Rewrite as a wrapper over gdbm_fd_open. * src/gdbmreorg.c (gdbm_reorganize): Rewrite as a wrapper over gdbm_recover. * src/proto.h (_gdbm_next_bucket_dir): New proto. * src/gdbmtool.c: New command: recover. * tests/.gitignore: Add gtrecover * tests/gtrecover.c: New test program. * tests/Makefile.am: Build gtrecover
2016-07-14Don't use hardcoded constantSergey Poznyakoff1
* src/gdbmconst.h (GDBM_HASH_BITS): New constant. * src/bucket.c: Use GDBM_HASH_BITS instead of the hardcoded value. * src/findkey.c (_gdbm_findkey): Use _gdbm_hash_key. * src/gdbmtool.c (hash_handler): Use _gdbm_hash_key if the database is open. * src/hash.c (_gdbm_bucket_dir, _gdbm_hash_key): New functions. * src/proto.h (_gdbm_bucket_dir, _gdbm_hash_key): New protos. * src/systems.h (STATBLKSIZE): Take a struct stat as argument. * src/gdbmopen.c (STATBLKSIZE): Takes argument now.
2016-07-09Don't bail out on fatal errors, unless the user defines the fatal_err functionSergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket) (_gdbm_split_bucket, _gdbm_write_bucket): Return error code. All callers updated. * src/proto.h (_gdbm_get_bucket) (_gdbm_split_bucket, _gdbm_write_bucket): Update declarations * src/falloc.c (push_avail_block) (pop_avail_block): Return error code. All callers updated. * src/update.c (_gdbm_fatal): Exit only if the user defined fatal_err function. * src/gdbmerrno.c (gdbm_needs_recovery): New function. * src/gdbm.h.in (gdbm_needs_recovery): New proto. * compat/dbminit.c: Set gdbm_errno on fatal errors. * compat/dbmopen.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmcount.c: Likewise. * src/gdbmdefs.h: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexists.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmreorg.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmsync.c: Likewise. * src/mmap.c: Likewise.
2016-07-09Per-database error state.Sergey Poznyakoff1
Last error code is stored in the database file structure as well as in the global gdbm_errno. Special functions are provided for retrieving and clearing the last error state. * src/gdbmdefs.h (gdbm_file_info): New member: last_error * src/gdbm.h.in (gdbm_last_errno, gdbm_set_errno) (gdbm_clear_error): New protos. * src/gdbmerrno.c (gdbm_last_errno, gdbm_set_errno) (gdbm_clear_error): New functions * NEWS: Update. * compat/dbminit.c: Use gdbm_set_errno to set error state. * compat/dbmopen.c: Likewise. * src/bucket.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmcount.c: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexists.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmreorg.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmsync.c: Likewise. * src/mmap.c: Likewise.
2015-03-01Switch to Texinfo 5.0Sergey Poznyakoff1
* doc/Config: Rewrite. * doc/Makefile.am: Use Makeinfo 5 instead of texi2htm * doc/gendocs_template: Ps is not built * imprimatur: Upgrade.
2013-12-25Version 1.11Sergey Poznyakoff1
2013-05-21New function gdbm_count.Sergey Poznyakoff1
* configure.ac: Check for unsigned long long, define substitution variable GDBM_COUNT_T. * src/gdbmcount.c: New file. * src/Makefile.am (libgdbm_la_SOURCES): Add gdbmcount.c. * src/bucket.c (_gdbm_read_bucket_at): New function. * src/gdbm.h.in (gdbm_count_t): New typedef. (gdbm_count): New proto. * src/gdbmdefs.h (GDBM_DIR_COUNT): New define. * src/proto.h (_gdbm_read_bucket_at): New proto. * src/var.c: New variable "filemode". * src/gdbmtool.c: Use gdbm_count. Various bugfixes. * NEWS: Update. * doc/gdbm.texinfo: Update.
2011-11-11Use SEEK_SET instead of L_SET.Sergey Poznyakoff1
2011-10-05Fix bug #150.Sergey Poznyakoff1
Tolerate I/O operations returning less bytes than expected. Retry I/O if possible. * src/fullio.c: New file. * src/Makefile.am (libgdbm_la_SOURCES): Add fullio.c * src/proto.h (_gdbm_full_read) (_gdbm_full_write): New protos. * src/gdbmerrno.c (gdbm_errlist): Add entry for GDBM_FILE_EOF. * src/bucket.c: Use _gdbm_full_{read|write}. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmstore.c: Likewise. * src/testgdbm.c: Likewise. * src/update.c: Likewise.
2011-08-16Internationalization.Sergey Poznyakoff1
* Makefile.am (SUBDIRS): Add po. (EXTRA_DIST): Add build-aux/config.rpath. * configure.ac (AC_CONFIG_FILES): Add po/Makefile.in. * bootstrap: New file. * src/Makefile.am (AM_CPPFLAGS): Define LOCALEDIR (noinst_HEADERS): Add gettext.h (LIBADD): New variable. * src/gettext.h: New file. * po/.cvsignore: New file. * po/Makevars: New file. * po/POTFILES.in: New file. * src/gdbmdefs.h: Define DEFAULT_TEXT_DOMAIN, _, N_ Include gettext.h * src/bucket.c: Add NLS markers. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbmerrno.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmstore.c: Likewise. * src/update.c: Likewise. * src/testgdbm.c: Add NLS markers. (main): Initialize I18N.
2011-08-03Update copyright headers.Sergey Poznyakoff1
2011-08-01Use GDBM_FILE instead of gdbm_file_info *.Sergey Poznyakoff1

Return to:

Send suggestions and report system problems to the System administrator.