summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org>2018-06-27 14:33:22 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-06-27 14:33:22 (GMT)
commit505faa939a83495603b2fd4a5c77d2ca8d5b08df (patch) (unidiff)
tree3e5550d33744abd9c566d994b6cd3f8cbfac7dd5 /src
parent3bf70df01fc591e10b204b69074e1ff4074f143b (diff)
downloadgdbm-505faa939a83495603b2fd4a5c77d2ca8d5b08df.tar.gz
gdbm-505faa939a83495603b2fd4a5c77d2ca8d5b08df.tar.bz2
New gdbmtool variables: coalesce and centfree
The two boolean variables control the use of free block coalescing and central free block modes in newly opened databases.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/gdbmtool.c15
-rw-r--r--src/var.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index e99547d..5ae668c 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -87,7 +87,7 @@ opendb (char *dbname)
87 flags |= GDBM_NOMMAP; 87 flags |= GDBM_NOMMAP;
88 if (variable_is_true ("sync")) 88 if (variable_is_true ("sync"))
89 flags |= GDBM_SYNC; 89 flags |= GDBM_SYNC;
90 90
91 if (open_mode == GDBM_NEWDB) 91 if (open_mode == GDBM_NEWDB)
92 { 92 {
93 if (interactive () && variable_is_true ("confirm") && 93 if (interactive () && variable_is_true ("confirm") &&
@@ -114,6 +114,19 @@ opendb (char *dbname)
114 gdbm_setopt (db, GDBM_CACHESIZE, &cache_size, sizeof (int)) == -1) 114 gdbm_setopt (db, GDBM_CACHESIZE, &cache_size, sizeof (int)) == -1)
115 terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno)); 115 terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
116 116
117 if (variable_is_true ("coalesce"))
118 {
119 int t = 1;
120 if (gdbm_setopt (db, GDBM_SETCOALESCEBLKS, &t, sizeof (t)) == -1)
121 terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
122 }
123 if (variable_is_true ("centfree"))
124 {
125 int t = 1;
126 if (gdbm_setopt (db, GDBM_SETCENTFREE, &t, sizeof (t)) == -1)
127 terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
128 }
129
117 if (gdbm_file) 130 if (gdbm_file)
118 gdbm_close (gdbm_file); 131 gdbm_close (gdbm_file);
119 132
diff --git a/src/var.c b/src/var.c
index be274c6..4765bc9 100644
--- a/src/var.c
+++ b/src/var.c
@@ -59,6 +59,8 @@ static struct variable vartab[] = {
59 { "lock", VART_BOOL, VARF_INIT, { .bool = 1 } }, 59 { "lock", VART_BOOL, VARF_INIT, { .bool = 1 } },
60 { "mmap", VART_BOOL, VARF_INIT, { .bool = 1 } }, 60 { "mmap", VART_BOOL, VARF_INIT, { .bool = 1 } },
61 { "sync", VART_BOOL, VARF_INIT, { .bool = 0 } }, 61 { "sync", VART_BOOL, VARF_INIT, { .bool = 0 } },
62 { "coalesce", VART_BOOL, VARF_INIT, { .bool = 0 } },
63 { "centfree", VART_BOOL, VARF_INIT, { .bool = 0 } },
62 { "filemode", VART_INT, VARF_INIT|VARF_OCTAL|VARF_PROT, { .num = 0644 } }, 64 { "filemode", VART_INT, VARF_INIT|VARF_OCTAL|VARF_PROT, { .num = 0644 } },
63 { "pager", VART_STRING, VARF_DFL }, 65 { "pager", VART_STRING, VARF_DFL },
64 { "quiet", VART_BOOL, VARF_DFL }, 66 { "quiet", VART_BOOL, VARF_DFL },

Return to:

Send suggestions and report system problems to the System administrator.