summaryrefslogtreecommitdiffabout
path: root/doc
authorSergey Poznyakoff <gray@gnu.org>2018-07-01 07:08:55 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-07-01 07:19:36 (GMT)
commit030e685eb9df82f63d73a1bf206da84b7aa52374 (patch) (unidiff)
treedcfc6693121e332d2cdb7c579e65ed0f397dc78e /doc
parentd6fe3b45bc669a6bc3f21e4bda69c6a052d78482 (diff)
downloadgdbm-030e685eb9df82f63d73a1bf206da84b7aa52374.tar.gz
gdbm-030e685eb9df82f63d73a1bf206da84b7aa52374.tar.bz2
Change return value of gdbm_close and gdbm_sync
* src/gdbm.h.in (gdbm_close, gdbm_sync): Return int (GDBM_FILE_CLOSE_ERROR, GDBM_FILE_SYNC_ERROR): New error codes. * src/gdbmclose.c (gdbm_close): Return 0 on success, -1 on failure. Set gdbm_errno and errno. * src/gdbmsync.c (gdbm_sync): Likewise. * src/gdbmerrno.c: Handle new error codes. * src/mmap.c (_gdbm_mapped_sync): Set gdbm_errno. * src/proto.h (gdbm_file_sync): Set gdbm_errno. * doc/gdbm.3: Document changes. * doc/gdbm.texi: Document changes. * NEWS: Document changes. * configure.ac: Set patchlevel. * tests/Makefile.am: Add new test. * tests/testsuite.at: Add new test. * tests/closerr.at: New test case. * tests/closerr.c: New test program. * tests/gtdel.c: Check gdbm_close return. * tests/gtdump.c: Likewise. * tests/gtfetch.c: Likewise. * tests/gtload.c: Likewise. * tests/gtopt.c: Likewise. * tests/gtrecover.c: Likewise.
Diffstat (limited to 'doc') (more/less context) (ignore whitespace changes)
-rw-r--r--doc/gdbm.310
-rw-r--r--doc/gdbm.texi16
2 files changed, 17 insertions, 9 deletions
diff --git a/doc/gdbm.3 b/doc/gdbm.3
index 6107d9a..d803748 100644
--- a/doc/gdbm.3
+++ b/doc/gdbm.3
@@ -13,7 +13,7 @@
13.\" 13.\"
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ 15.\" along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
16.TH GDBM 3 "July 8, 2016" "GDBM" "GDBM User Reference" 16.TH GDBM 3 "July 1, 2018" "GDBM" "GDBM User Reference"
17.SH NAME 17.SH NAME
18GDBM \- The GNU database manager. Includes \fBdbm\fR and \fBndbm\fR 18GDBM \- The GNU database manager. Includes \fBdbm\fR and \fBndbm\fR
19compatibility. 19compatibility.
@@ -31,7 +31,7 @@ compatibility.
31.ti +21 31.ti +21
32.BI "void (*" fatal_func ")(const char *))"; 32.BI "void (*" fatal_func ")(const char *))";
33.br 33.br
34.BI "void gdbm_close (GDBM_FILE " dbf ");" 34.BI "int gdbm_close (GDBM_FILE " dbf ");"
35.br 35.br
36.BI "int gdbm_store (GDBM_FILE " dbf ", datum " key ", datum " content ", int " flag ); 36.BI "int gdbm_store (GDBM_FILE " dbf ", datum " key ", datum " content ", int " flag );
37.br 37.br
@@ -45,7 +45,7 @@ compatibility.
45.br 45.br
46.BI "int gdbm_reorganize (GDBM_FILE " dbf ");" 46.BI "int gdbm_reorganize (GDBM_FILE " dbf ");"
47.br 47.br
48.BI "void gdbm_sync (GDBM_FILE " dbf ");" 48.BI "int gdbm_sync (GDBM_FILE " dbf ");"
49.br 49.br
50.BI "int gdbm_exists (GDBM_FILE " dbf ", datum " key ); 50.BI "int gdbm_exists (GDBM_FILE " dbf ", datum " key );
51.br 51.br
@@ -183,7 +183,7 @@ returned from \fBgdbm_open\fR.
183It is important that every file opened is also closed. This is needed to 183It is important that every file opened is also closed. This is needed to
184update the reader/writer count on the file. This is done by: 184update the reader/writer count on the file. This is done by:
185 185
186.BI "void gdbm_close (GDBM_FILE " dbf ");" 186.BI "int gdbm_close (GDBM_FILE " dbf ");"
187 187
188The database is used by 3 primary routines. The first stores data in the 188The database is used by 3 primary routines. The first stores data in the
189database. 189database.
@@ -308,7 +308,7 @@ wait for writes to be flushed to the disk before continuing.
308The following routine can be used to guarantee that the database is 308The following routine can be used to guarantee that the database is
309physically written to the disk file. 309physically written to the disk file.
310 310
311.BI "void gdbm_sync (GDBM_FILE " dbf ");" 311.BI "int gdbm_sync (GDBM_FILE " dbf ");"
312 312
313It will not return until the disk file state is syncronized with the 313It will not return until the disk file state is syncronized with the
314in-memory state of the database. 314in-memory state of the database.
diff --git a/doc/gdbm.texi b/doc/gdbm.texi
index b5ba53d..4a0b1a7 100644
--- a/doc/gdbm.texi
+++ b/doc/gdbm.texi
@@ -215,14 +215,14 @@ contains a definition of these functions.
215#include <gdbm.h> 215#include <gdbm.h>
216 216
217GDBM_FILE gdbm_open(name, block_size, flags, mode, fatal_func); 217GDBM_FILE gdbm_open(name, block_size, flags, mode, fatal_func);
218void gdbm_close(dbf); 218int gdbm_close(dbf);
219int gdbm_store(dbf, key, content, flag); 219int gdbm_store(dbf, key, content, flag);
220datum gdbm_fetch(dbf, key); 220datum gdbm_fetch(dbf, key);
221int gdbm_delete(dbf, key); 221int gdbm_delete(dbf, key);
222datum gdbm_firstkey(dbf); 222datum gdbm_firstkey(dbf);
223datum gdbm_nextkey(dbf, key); 223datum gdbm_nextkey(dbf, key);
224int gdbm_reorganize(dbf); 224int gdbm_reorganize(dbf);
225void gdbm_sync(dbf); 225int gdbm_sync(dbf);
226int gdbm_exists(dbf, key); 226int gdbm_exists(dbf, key);
227char *gdbm_strerror(errno); 227char *gdbm_strerror(errno);
228int gdbm_setopt(dbf, option, value, size); 228int gdbm_setopt(dbf, option, value, size);
@@ -369,7 +369,7 @@ Copy file ownership and mode from @var{src} to @var{dst}.
369It is important that every file opened is also closed. This is needed to 369It is important that every file opened is also closed. This is needed to
370update the reader/writer count on the file: 370update the reader/writer count on the file:
371 371
372@deftypefn {gdbm interface} void gdbm_close (GDBM_FILE @var{dbf}) 372@deftypefn {gdbm interface} int gdbm_close (GDBM_FILE @var{dbf})
373This function closes the @code{gdbm} file and frees all memory 373This function closes the @code{gdbm} file and frees all memory
374associated with it. The parameter is: 374associated with it. The parameter is:
375 375
@@ -377,6 +377,10 @@ associated with it. The parameter is:
377@item dbf 377@item dbf
378The pointer returned by @code{gdbm_open}. 378The pointer returned by @code{gdbm_open}.
379@end table 379@end table
380
381@code{Gdbm_close} returns 0 on success. On error, it sets
382@code{gdbm_errno} and system @code{errno} variables to the codes
383describing the error and returns -1.
380@end deftypefn 384@end deftypefn
381 385
382@node Count 386@node Count
@@ -678,7 +682,7 @@ abnormal fashion. The following function allows the programmer to
678make sure the disk version of the database has been completely updated 682make sure the disk version of the database has been completely updated
679with all changes to the current time. 683with all changes to the current time.
680 684
681@deftypefn {gdbm interface} void gdbm_sync (GDBM_FILE @var{dbf}) 685@deftypefn {gdbm interface} int gdbm_sync (GDBM_FILE @var{dbf})
682Synchronizes the changes in @var{dbf} with its disk file. The 686Synchronizes the changes in @var{dbf} with its disk file. The
683parameter is a pointer returned by @code{gdbm_open}. 687parameter is a pointer returned by @code{gdbm_open}.
684 688
@@ -687,6 +691,10 @@ have been made to the database and before some long waiting time.
687The @code{gdbm_close} function automatically calls the equivalent of 691The @code{gdbm_close} function automatically calls the equivalent of
688@code{gdbm_sync} so no call is needed if the database is to be closed 692@code{gdbm_sync} so no call is needed if the database is to be closed
689immediately after the set of changes have been made. 693immediately after the set of changes have been made.
694
695@code{Gdbm_sync} returns 0 on success. On error, it sets
696@code{gdbm_errno} and system @code{errno} variables to the codes
697describing the error and returns -1.
690@end deftypefn 698@end deftypefn
691 699
692@node Flat files 700@node Flat files

Return to:

Send suggestions and report system problems to the System administrator.