diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-08-10 23:26:56 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-08-10 23:26:56 +0000 |
commit | e5f0f221444618ba6004d697af2535bdaff906bf (patch) | |
tree | dc6285c26798934129a0b9fbfbc68a788ea06177 /doc/gdbm.texinfo | |
parent | 74f7fe561e31637bdbf21aeb817d4a22bbf9c91a (diff) | |
download | gdbm-e5f0f221444618ba6004d697af2535bdaff906bf.tar.gz gdbm-e5f0f221444618ba6004d697af2535bdaff906bf.tar.bz2 |
Improve gdbm_setopt interface.
* 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.
Diffstat (limited to 'doc/gdbm.texinfo')
-rw-r--r-- | doc/gdbm.texinfo | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/doc/gdbm.texinfo b/doc/gdbm.texinfo index 5dc8a97..04efeea 100644 --- a/doc/gdbm.texinfo +++ b/doc/gdbm.texinfo | |||
@@ -739,7 +739,7 @@ open database. | |||
739 | 739 | ||
740 | @deftypefn {gdbm interface} int gdbm_setopt (GDBM_FILE @var{dbf}, int @var{option}, @ | 740 | @deftypefn {gdbm interface} int gdbm_setopt (GDBM_FILE @var{dbf}, int @var{option}, @ |
741 | void *@var{value}, int @var{size}) | 741 | void *@var{value}, int @var{size}) |
742 | Sets an option on the database. | 742 | Sets an option on the database or returns the value of an option. |
743 | 743 | ||
744 | The parameters are: | 744 | The parameters are: |
745 | 745 | ||
@@ -747,9 +747,10 @@ The parameters are: | |||
747 | @item dbf | 747 | @item dbf |
748 | The pointer returned by @code{gdbm_open}. | 748 | The pointer returned by @code{gdbm_open}. |
749 | @item option | 749 | @item option |
750 | The option to be set. | 750 | The option to be set or retreived. |
751 | @item value | 751 | @item value |
752 | A pointer to the value to which @var{option} will be set. | 752 | A pointer to the value to which @var{option} will be set or where to |
753 | place the option value (depending on the option). | ||
753 | @item size | 754 | @item size |
754 | The length of the data pointed to by @var{value}. | 755 | The length of the data pointed to by @var{value}. |
755 | @end table | 756 | @end table |
@@ -759,11 +760,29 @@ The valid options are: | |||
759 | 760 | ||
760 | @table @asis | 761 | @table @asis |
761 | @kwindex GDBM_CACHESIZE | 762 | @kwindex GDBM_CACHESIZE |
762 | @item GDBM_CACHESIZE | 763 | @kwindex GDBM_SETCACHESIZE |
764 | @item GDBM_SETCACHESIZE | ||
765 | @itemx GDBM_CACHESIZE | ||
763 | Set the size of the internal bucket cache. This option may only be | 766 | Set the size of the internal bucket cache. This option may only be |
764 | set once on each GDBM_FILE descriptor, and is set automatically to 100 | 767 | set once on each GDBM_FILE descriptor, and is set automatically to 100 |
765 | upon the first access to the database. The @var{value} should point | 768 | upon the first access to the database. The @var{value} should point |
766 | to an integer holding the desired cache size. | 769 | to a @code{size_t} holding the desired cache size. |
770 | |||
771 | The @samp{GDBM_CACHESIZE} option is provided for compatibility with | ||
772 | earlier versions. | ||
773 | |||
774 | @kwindex GDBM_GETCACHESIZE | ||
775 | @item GDBM_GETCACHESIZE | ||
776 | Return the size of the internal bucket cache. The @var{value} should | ||
777 | point to a @code{size_t} variable, where the size will be stored. | ||
778 | |||
779 | @kwindex GDBM_GETFLAGS | ||
780 | @item GDBM_GETFLAGS | ||
781 | Return the flags describing the state of the database. The @var{value} should | ||
782 | point to a @code{int} variable where to store the flags. The return | ||
783 | is the same as the flags used when opening the database (@pxref{Open, | ||
784 | gdbm_open}), except that it reflects the current state (which may have | ||
785 | been altered by another calls to @code{gdbm_setopt}. | ||
767 | 786 | ||
768 | @kwindex GDBM_FASTMODE | 787 | @kwindex GDBM_FASTMODE |
769 | @item GDBM_FASTMODE | 788 | @item GDBM_FASTMODE |
@@ -773,22 +792,34 @@ to an integer: @samp{TRUE} to enable fast mode, and @samp{FALSE} to | |||
773 | disable it. | 792 | disable it. |
774 | 793 | ||
775 | This option is retained for compatibility with previous versions of | 794 | This option is retained for compatibility with previous versions of |
776 | @code{gdbm}. Its effect is the reverse of @code{GDBM_SYNCMODE} | 795 | @code{gdbm}. Its effect is the reverse of @code{GDBM_SETSYNCMODE} |
777 | (see below). | 796 | (see below). |
778 | 797 | ||
798 | @kwindex GDBM_SETSYNCMODE | ||
779 | @kwindex GDBM_SYNCMODE | 799 | @kwindex GDBM_SYNCMODE |
780 | @item GDBM_SYNCMODE | 800 | @item GDBM_SETSYNCMODE |
801 | @itemx GDBM_SYNCMODE | ||
781 | Turn on or off file system synchronization operations. This | 802 | Turn on or off file system synchronization operations. This |
782 | setting defaults to off. The @var{value} should point | 803 | setting defaults to off. The @var{value} should point |
783 | to an integer: @samp{TRUE} to turn synchronization on, and @samp{FALSE} to | 804 | to an integer: @samp{TRUE} to turn synchronization on, and @samp{FALSE} to |
784 | turn it off. | 805 | turn it off. |
785 | 806 | ||
786 | Note, that this option is a reverse of @code{GDBM_FASTMODE}, | 807 | Note, that this option is a reverse of @code{GDBM_FASTMODE}, |
787 | i.e. calling @code{GDBM_SYNCMODE} with @samp{TRUE} has the same effect | 808 | i.e. calling @code{GDBM_SETSYNCMODE} with @samp{TRUE} has the same effect |
788 | as calling @code{GDBM_FASTMODE} with @samp{FALSE}. | 809 | as calling @code{GDBM_FASTMODE} with @samp{FALSE}. |
789 | 810 | ||
811 | The @samp{GDBM_SYNCMODE} option is provided for compatibility with | ||
812 | earlier versions. | ||
813 | |||
814 | @kwindex GDBM_GETSYNCMODE | ||
815 | @item GDBM_GETSYNCMODE | ||
816 | Return the current synchronization status. The @var{value} should | ||
817 | point to an @code{int} where the status will be stored. | ||
818 | |||
819 | @kwindex GDBM_SETCENTFREE | ||
790 | @kwindex GDBM_CENTFREE | 820 | @kwindex GDBM_CENTFREE |
791 | @item GDBM_CENTFREE | 821 | @item GDBM_SETCENTFREE |
822 | @itemx GDBM_CENTFREE | ||
792 | @emph{NOTICE: This feature is still under study.} | 823 | @emph{NOTICE: This feature is still under study.} |
793 | 824 | ||
794 | Set central free block pool to either on or off. The default is off, | 825 | Set central free block pool to either on or off. The default is off, |
@@ -798,8 +829,13 @@ set, this option causes all subsequent free blocks to be placed in the | |||
798 | more quickly. The @var{value} should point to an integer: @samp{TRUE} to | 829 | more quickly. The @var{value} should point to an integer: @samp{TRUE} to |
799 | turn central block pool on, and @samp{FALSE} to turn it off. | 830 | turn central block pool on, and @samp{FALSE} to turn it off. |
800 | 831 | ||
832 | The @samp{GDBM_CENTFREE} option is provided for compatibility with | ||
833 | earlier versions. | ||
834 | |||
835 | @kwindex GDBM_SETCOALESCEBLKS | ||
801 | @kwindex GDBM_COALESCEBLKS | 836 | @kwindex GDBM_COALESCEBLKS |
802 | @item GDBM_COALESCEBLKS | 837 | @item GDBM_SETCOALESCEBLKS |
838 | @itemx GDBM_COALESCEBLKS | ||
803 | @emph{NOTICE: This feature is still under study.} | 839 | @emph{NOTICE: This feature is still under study.} |
804 | 840 | ||
805 | Set free block merging to either on or off. The default is off, which | 841 | Set free block merging to either on or off. The default is off, which |
@@ -810,13 +846,34 @@ used in conjunction with GDBM_CENTFREE. The @var{value} should point | |||
810 | to an integer: @samp{TRUE} to turn free block merging on, and @samp{FALSE} to | 846 | to an integer: @samp{TRUE} to turn free block merging on, and @samp{FALSE} to |
811 | turn it off. | 847 | turn it off. |
812 | 848 | ||
849 | @kwindex GDBM_GETCOALESCEBLKS | ||
850 | @item GDBM_GETCOALESCEBLKS | ||
851 | Return the current status of free block merging. The @var{value} should | ||
852 | point to an @code{int} where the status will be stored. | ||
853 | |||
813 | @kwindex GDBM_SETMAXMAPSIZE | 854 | @kwindex GDBM_SETMAXMAPSIZE |
814 | @item GDBM_SETMAXMAPSIZE | 855 | @item GDBM_SETMAXMAPSIZE |
815 | Sets maximum size of the memory mapped region. The @var{value} should | 856 | Sets maximum size of a memory mapped region. The @var{value} should |
816 | point to a value of type @code{size_t}, @code{unsigned long} or | 857 | point to a value of type @code{size_t}, @code{unsigned long} or |
817 | @code{unsigned}. The actual value is rounded to the nearest page | 858 | @code{unsigned}. The actual value is rounded to the nearest page |
818 | boundary (the page size is obtained from | 859 | boundary (the page size is obtained from |
819 | @code{sysconf(_SC_PAGESIZE)}). | 860 | @code{sysconf(_SC_PAGESIZE)}). |
861 | |||
862 | @kwindex GDBM_GETMAXMAPSIZE | ||
863 | @item GDBM_GETMAXMAPSIZE | ||
864 | Return the maximum size of a memory mapped region. The @var{value} should | ||
865 | point to a value of type @code{size_t} where to return the data. | ||
866 | |||
867 | @kwindex GDBM_SETMMAP | ||
868 | @item GDBM_SETMMAP | ||
869 | Enable or disable memory mapping mode. The @var{value} should point | ||
870 | to an integer: @samp{TRUE} to enable memory mapping or @samp{FALSE} to | ||
871 | disable it. | ||
872 | |||
873 | @kwindex GDBM_GETMMAP | ||
874 | @item GDBM_GETMMAP | ||
875 | Check whether memory mapping is enabled. The @var{value} should point | ||
876 | to an integer where to return the status. | ||
820 | @end table | 877 | @end table |
821 | 878 | ||
822 | The return value will be @samp{-1} upon failure, or @samp{0} upon | 879 | The return value will be @samp{-1} upon failure, or @samp{0} upon |