summaryrefslogtreecommitdiffabout
path: root/src/proto.h
authorSergey Poznyakoff <gray@gnu.org>2018-05-30 09:45:21 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-05-30 09:45:21 (GMT)
commitb8d5da4c426b21ca0e56fc1cd6f75b49c0668e95 (patch) (side-by-side diff)
tree26cbb1b04cd9febcdd37237c9576ea1c5eff3926 /src/proto.h
parenta14a6881538229cd938282bd56c7f0d12a089be6 (diff)
downloadgdbm-b8d5da4c426b21ca0e56fc1cd6f75b49c0668e95.tar.gz
gdbm-b8d5da4c426b21ca0e56fc1cd6f75b49c0668e95.tar.bz2
Namespace cleanup
Rename: __read to gdbm_file_read __write to gdbm_file_write __lseek to gdbm_file_seek __fsync to gdbm_file_sync
Diffstat (limited to 'src/proto.h') (more/less context) (ignore whitespace changes)
-rw-r--r--src/proto.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/proto.h b/src/proto.h
index 9592f52..563505f 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -85,2 +85,22 @@ int _gdbm_next_bucket_dir (GDBM_FILE dbf, int bucket_dir);
+/* I/O macros. */
+#if HAVE_MMAP
+# define gdbm_file_read(_dbf, _buf, _size) \
+ _gdbm_mapped_read(_dbf, _buf, _size)
+# define gdbm_file_write(_dbf, _buf, _size) \
+ _gdbm_mapped_write(_dbf, _buf, _size)
+# define gdbm_file_seek(_dbf, _off, _whn) \
+ _gdbm_mapped_lseek(_dbf, _off, _whn)
+# define gdbm_file_sync(_dbf) \
+ _gdbm_mapped_sync(_dbf)
+#else
+# define gdbm_file_read(_dbf, _buf, _size) read(_dbf->desc, _buf, _size)
+# define gdbm_file_write(_dbf, _buf, _size) write(_dbf->desc, _buf, _size)
+# define gdbm_file_seek(_dbf, _off, _whn) lseek(_dbf->desc, _off, _whn)
+# if HAVE_FSYNC
+# define gdbm_file_sync(_dbf) fsync(_dbf->desc)
+# else
+# define gdbm_file_sync(_dbf) { sync(); sync(); }
+# endif
+#endif

Return to:

Send suggestions and report system problems to the System administrator.