aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmdefs.h
AgeCommit message (Collapse)AuthorFiles
2018-06-23Silently restore sorting order of avail array when checking it.Sergey Poznyakoff1
* src/gdbmdefs.h (gdbm_avail_table_valid_p): Remove const qualifier from the AV parameter. * src/gdbmopen.c (gdbm_avail_table_valid_p): Don't insist on proper ordering of the array. Restore it if neccessary.
2018-05-30Avoid unnecessary memory reallocations during cachingSergey Poznyakoff1
* src/findkey.c (_gdbm_read_entry): Reallocate cache_entry->ca_data.dptr only if necessary. * src/gdbmdefs.h (data_cache_elem): New member: dsize * src/gdbmdelete.c: Don't free cache_entry->ca_data.dptr * src/gdbmopen.c (_gdbm_init_cache): Initialize ca_data.dsize
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-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-24More input checking fixesSergey Poznyakoff1
* src/gdbmdefs.h (gdbm_avail_block_valid_p): Minimal capacity of an avail_block is 1 (one entry is stored in the block itself). * src/gdbmopen.c (gdbm_avail_table_valid_p): New function. (validate_header): Fix verification of dir_size and dir_bits. Verify avail.size. * src/falloc.c (pop_avail_block): Use gdbm_avail_table_valid_p * src/gdbmtool.c (_gdbm_print_avail_list): Likewise.
2018-05-24More error checking; improve gdbm_recoverSergey Poznyakoff1
* Makefile.am (set-dist-date): New rule (dist-hook): Catch FIXMEs in NEWS. * NEWS: Updated. * src/findkey.c (gdbm_bucket_element_valid_p): New function. (_gdbm_read_entry): Validate the retrieved bucket element. * src/gdbm.h.in (gdbm_recovery): New member: duplicate_keys. (GDBM_BAD_HASH_TABLE): New error code. * src/gdbmdefs.h (TYPE_WIDTH,SIGNED_TYPE_MAXIMUM) (OFF_T_MAX): New defines. (off_t_sum_ok): New function. (gdbm_bucket_element_valid_p): New prototype. * src/gdbmerrno.c: Support for GDBM_BAD_HASH_TABLE code. * src/gdbmtool.c (recover_handler): Fix argument counting. New argument 'summary' prints statistics summary at the end of the run. (export_handler,import_handler): Fix argument counting. * src/mmap.c (SUM_FILE_SIZE): Rewrite as inlined function. Add error checking. (_gdbm_mapped_remap): More error checking. * src/recover.c (run_recovery): Don't bail out on GDBM_CANNOT_REPLACE. (gdbm_recover): Initialize duplicate_keys * src/systems.h: Include limits.h
2018-05-24error checking: check for avail_block consistency before using itSergey Poznyakoff1
* src/gdbmdefs.h (gdbm_avail_block_valid_p): New function. * src/gdbm.h.in (GDBM_BAD_AVAIL): New error code. * src/gdbmerrno.c: Support new error code. * src/falloc.c (pop_avail_block): Validate the avail_block * src/gdbmopen.c (validate_header): Validate the avail_block. * src/gdbmtool.c (_gdbm_avail_list_size) (_gdbm_print_avail_list): Validate the avail_block.
2018-01-01Happy GNU YearSergey Poznyakoff1
2017-01-02Happy GNU YearSergey Poznyakoff1
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-25Add debug info.Sergey Poznyakoff1
* configure.ac: Fix description wording. * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Don't define GDBM_DEBUG_ENABLE. * tests/Makefile.am: Likewise. * src/debug.c (gdbm_debug_printer) (gdbm_debug_flags): New globals. (gdbm_debug_token, gdbm_debug_parse_state) (gdbm_debug_datum): New functions. * src/gdbm.h.in [@GDBM_DEBUG_ENABLE@]: Define GDBM_DEBUG_ENABLE. (gdbm_debug_printer_t): New typedef. (gdbm_debug_printer, gdbm_debug_flags): New externs. (GDBM_DEBUG_ERR,GDBM_DEBUG_OPEN) (GDBM_DEBUG_READ,GDBM_DEBUG_STORE) (GDBM_DEBUG_LOOKUP,GDBM_DEBUG_ALL): New defines. (gdbm_debug_token,gdbm_debug_parse_state) (gdbm_debug_datum): New protos. * src/gdbmdefs.h (GDBM_DEBUG,GDBM_DEBUG_DATUM): New macros. * src/findkey.c: Add debugging info. * src/gdbmfetch.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmtool.c (open_handler): Allow the use of ~/ (command) <repeat,variadic>: New members. (run_command): Handle variadic functions. (run_last_command): New command. In interactive mode, repeats the last command if it was marked with repeat=1 (currently, only "next"). New command: "debug". (all functions): Use terror instead of fprintf(stderr,...); * src/gdbmtool.h (handler_param) <vararg>: New member. (run_last_command): New proto. * src/gram.y: Call run_last_command) on empty input. * tests/gtload.c: New option: -debug=
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-19Improve docs. Minor changes.Sergey Poznyakoff1
* NEWS: Document new features. * doc/gdbm.texi: Likewise. * src/gdbm.h.in (gdbm_last_errno): Fix return value. (gdbm_check_syserr): New proto. * src/gdbmdefs.h (gdbm_file_info) <last_error>: Fix data type. * src/gdbmerrno.c (gdbm_last_errno): Fix return value. (gdbm_check_syserr): New function.
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-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-09All gdbm functions return immediately if the DB is in inconsistent sate ↵Sergey Poznyakoff1
(needs recovery). * src/gdbm.h.in (GDBM_NEED_RECOVERY): New error code. * src/gdbmdefs.h (GDBM_ASSERT_CONSISTENCY): New macro. * src/gdbmerrno.c: Update. * src/gdbmopen.c (gdbm_open): Initialize need_recovery and last_error. * src/gdbmcount.c (gdbm_count): Return immediately if the database needs recovery. * src/gdbmdelete.c (gdbm_delete): Likewise. * src/gdbmdump.c (gdbm_dump_to_file, gdbm_dump): Likewise. * src/gdbmexists.c (gdbm_exists): Likewise. * src/gdbmexp.c (gdbm_export_to_file): Likewise. * src/gdbmfetch.c (gdbm_fetch): Likewise. * src/gdbmimp.c (gdbm_import_from_file): Likewise. * src/gdbmreorg.c (gdbm_reorganize): Likewise. * src/gdbmseq.c (gdbm_firstkey): Likewise. * src/gdbmsetopt.c (gdbm_nextkey): Likewise. * src/gdbmstore.c (gdbm_store): Likewise. * src/gdbmsync.c (gdbm_sync): 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.
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.
2013-05-15Add "pager" variable and "unset" command.Sergey Poznyakoff1
* src/gdbmtool.c (command_tab) <unset>: New command. (run_command): Get pager value from the variable. * src/gdbmtool.h (VAR_ERR_NOTSET): New error code. (variable_is_true): New function. Replaces variable_is_set, which changed semantics. * src/gram.y: Implement the unset command. * src/var.c: Support the "unset variable" notion. (VARF_INIT): New flag. (VAR_IS_SET): New define. (vartab): Mark initialized variables with VARF_INIT. New variable "pager". (open_hook): v can be NULL. (variable_set): NULL value unsets the variable. (variable_unset): New function. (variable_get): Return VAR_ERR_NOTSET if the variable is not set. (variable_is_true): Renamed from variable_is_set. (variable_is_set): New function. * src/gdbmdefs.h: Fix some typos.
2013-05-08Improve testgdbm; install some more bugfixes.Sergey Poznyakoff1
* src/gdbmdefs.h: Fix typo in a comment. * src/gdbmdump.c (gdbm_dump_to_file): Improve error checking. * src/testgdbm.c: Improve interactive usage. (command) <minlen>: Rename to len. (command_tab): Initialize len. (set_minimal_abbreviations): Remove. (sort_commands): New function. (find_command): Print possible alternatives in case of ambiguous input. (main): Reset param.argc after freeing previous arguments. Continue silently if find_command returns NULL.
2011-11-13Implement new dump format. Add new utilities: gdbm_dump and gdbm_load.Sergey Poznyakoff1
* configure.ac (AC_CHECK_HEADERS): Don't check for files that must always be present. Check for getopt.h. (AC_CHECK_FUNCS): Add getopt_long * src/systems.h: Include useless #if's. * src/flatfile.c: Split into two files: * src/gdbmexp.c: ... this and ... * src/gdbmimp.c: .., this * src/mem.c: New file. * src/base64.c: New file. * src/gdbm_dump.c: New file. * src/gdbm_load.c: New file. * src/gdbmapp.h: New file. * src/gdbmdump.c: New file. * src/gdbmload.c: New file. * src/parseopt.c: New file. * src/progname.c: New file. * src/.cvsignore: Update. * src/Makefile.am (libgdbm_la_SOURCES): Add new files. (noinst_LIBRARIES): New variable. Build libgdbmapp.a. (libgdbmapp_a_SOURCES): New variable. (bin_PROGRAMS): Add gdbm_load and gdbm_dump (testgdbm_LDADD, gdbm_load_LDADD) (gdbm_dump_LDADD): Add ./libgdbmapp.a * src/gdbm.h.in: Include <stdio.h> (gdbm_export_to_file) (gdbm_import_from_file): New prototypes. (GDBM_DUMP_FMT_BINARY,GDBM_DUMP_FMT_ASCII): New constants. (gdbm_dump,gdbm_load) (gdbm_dump_to_file,gdbm_load_from_file): New prototypes. (GDBM_NO_DBNAME): New error code. (_GDBM_MAX_ERRNO): Update. * src/gdbmdefs.h (_GDBM_MAX_DUMP_LINE_LEN): New constant. * src/gdbmerrno.c (gdbm_errlist): Add entry for GDBM_NO_DBNAME. * src/proto.h (_gdbm_base64_encode,_gdbm_base64_decode) (_gdbm_load,_gdbm_dump): New prototypes. * src/testgdbm.c: Use gdbmapp interface for option parsing. * export/export.c: Include gdbmexp.c * export/.cvsignore: Update. * doc/gdbm.texinfo: Update.
2011-11-11Implement cloexec in gdbm_reorganize. Add test cases.Sergey Poznyakoff1
* compat/dbmopen.c: Apply O_CLOEXEC for newly created dir file, if requested. * src/gdbmdefs.h (gdbm_file_info) <cloexec>: New member. * src/gdbmopen.c (gdbm_open): Initialize cloexec member. * src/gdbmreorg.c (gdbm_reorganize): Propagate cloexec bit to the new database. * tests/.cvsignore: Update. * tests/cloexec00.at: New test case. * tests/cloexec01.at: Likewise. * tests/cloexec02.at: Likewise. * tests/cloexec03.at: Likewise. * fdop.c: New auxiliary program. * g_open_ce: New test program. * g_reorg_ce: New test program. * d_creat_ce: New test program. * tests/Makefile.am: Add new test cases and test programs. * tests/testsuite.at: Include new test cases. * doc/gdbm.texinfo: Minor change.
2011-08-17Make sure errno is preserved, if it can contain details about the gdbm error.Sergey Poznyakoff1
* src/gdbmdefs.h (SAVE_ERRNO): New macro. * src/gdbmopen.c: Use SAVE_ERRNO where it is important to preserve system errno. * src/mmap.c: Likewise. * doc/gdbm.texinfo: Document which gdbm errors can be detailed by inspecting the system errno.
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-10Improve gdbm_setopt interface.Sergey Poznyakoff1
* src/gdbm.h.in (GDBM_OPENMASK): New constant. * src/gdbmconst.h: Remove constants duplicated in gdbm.h.in. * src/gdbmdefs.h (gdbm_file_info) <allow_mmap> <mmap_inited>: Replace with a single member: memory_mapping. All callers updated. (GDBM_SETCACHESIZE,GDBM_SETSYNCMODE) (GDBM_SETCENTFREE,GDBM_SETCOALESCEBLKS): New option names. (GDBM_SETMMAP,GDBM_GETMMAP,GDBM_GETFLAGS) (GDBM_GETCACHESIZE,GDBM_GETSYNCMODE,GDBM_GETCENTFREE) (GDBM_GETCOALESCEBLKS,GDBM_GETMAXMAPSIZE): New option codes. * src/gdbmsetopt.c: Implement new options. * doc/gdbm.texinfo: Document new options.
2011-08-10Improve memory mapping support.Sergey Poznyakoff1
The new code is more flexible and performs better when lots of inserts are being made (e.g. when populating the database with new data). * src/gdbm.h.in (GDBM_SETMAXMAPSIZE): New constant. * src/gdbmconst.h (SIZE_T_MAX): New define. * src/gdbmdefs.h (gdbm_file_info) <cache_size>: Change type to size_t. <mmap_inited,mapped_size_max>: New member. <mapped_remap>: Remove. * src/gdbmopen.c: Fix a typo. (gdbm_open): Initialize new members. (_gdbm_init_cache): Second argument is size_t. * src/gdbmsetopt.c (gdbm_setopt): Optval argument is void*. Handle GDBM_SETMAXMAPSIZE. Improve error checking. * src/mmap.c (_GDBM_IN_MAPPED_REGION_P): Fix comparison with the lower bound. (_GDBM_NEED_REMAP): Return true if mapped_region is NULL. (SUM_FILE_SIZE): Rewrite. (_gdbm_mapped_unmap): Don't call msync. (_gdbm_internal_remap): Take 2 arguments, the second one giving the new mapped size. Unmap the region prior to remapping it. Always pass NULL as the argument to mmap. (_gdbm_mapped_remap): Rewrite the logic. Change semantics of the third argument. All uses updated. (_gdbm_mapped_init): Reflect the above changes. (_gdbm_mapped_read,_gdbm_mapped_write): Use mmap_inited to decide whether to use mmap, because mapped_region can be reset to zero by another functions (namely, _gdbm_mapped_lseek). Reset mmap_inited to FALSE, if _gdbm_mapped_remap fails. (_gdbm_mapped_lseek): Rewrite offset computations. Invalidate the mapped region. * src/proto.h (_gdbm_init_cache): Change prototype. * src/update.c (write_header, _gdbm_end_update): Remove checks for dbf->mapped_region. * tests/gtload.c: Implement the -maxmap option (set maximal mapped memory size). * doc/gdbm.texinfo: Document GDBM_SETMAXMAPSIZE.
2011-08-03Update copyright headers.Sergey Poznyakoff1
2011-08-03(struct gdbm_file_info) <name>: Remove the static qualifier.Sergey Poznyakoff1
2011-08-01Include gdbm.hSergey Poznyakoff1
(datum): Remove duplicate declaration. (gdbm_file_info): Change to struct gdbm_file_info
2008-12-01Finish up lock.c, adding error checking to see if a lock failed because it'sJason Downs1
already locked. Also added gdbm_locked() to the API. * src/lock.c: Check errno to see if a lock failed because it's already locked. Add external gdbm_locked() routine to return the status of locking. Move lock type to the dbf. * src/gdbmdefs.h: Move lock type to the dbf. * src/gdbm.proto: Add gdbm_export(), gdbm_import(), and gdbm_locked().
2008-11-21Initial revisionJason Downs1

Return to:

Send suggestions and report system problems to the System administrator.