summaryrefslogtreecommitdiffabout
path: root/src/proto.h
Side-by-side diff
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.