return *p1 - *p2;
}
+char *
+mdb_version(int *maj, int *min, int *pat)
+{
+ *maj = MDB_VERSION_MAJOR;
+ *min = MDB_VERSION_MINOR;
+ *pat = MDB_VERSION_PATCH;
+ return MDB_VERSION_STRING;
+}
+
int
mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
{
}
int
-mdb_env_sync(MDB_env *env)
+mdb_env_sync(MDB_env *env, int force)
{
int rc = 0;
- if (!F_ISSET(env->me_flags, MDB_NOSYNC)) {
+ if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) {
if (fsync(env->me_fd))
rc = errno;
}
free(dp);
}
- if ((n = mdb_env_sync(env)) != 0 ||
+ if ((n = mdb_env_sync(env, 0)) != 0 ||
(n = mdb_env_write_meta(txn)) != MDB_SUCCESS ||
- (n = mdb_env_sync(env)) != 0) {
+ (n = mdb_env_sync(env, 0)) != 0) {
mdb_txn_abort(txn);
return n;
}
#define MDB_VERSION_MAJOR 0
#define MDB_VERSION_MINOR 8
#define MDB_VERSION_PATCH 0
-#define MDB_VERSION_FULL ((MDB_VERSION_MAJOR << 24) | (MDB_VERSION_MINOR << 16) | MDB_VERSION_PATCH)
+#define MDB_VERINT(a,b,c) ((a << 24) | (b << 16) | c)
+#define MDB_VERSION_FULL \
+ MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH)
+#define MDB_VERSION_DATE "August 11, 2011"
+#define MDB_VERSTR(a,b,c,d) "MDB " #a "." #b "." #c ": (" #d ")"
+#define MDB_VERFOO(a,b,c,d) MDB_VERSTR(a,b,c,d)
+#define MDB_VERSION_STRING \
+ MDB_VERFOO(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH,MDB_VERSION_DATE)
struct MDB_cursor;
struct MDB_txn;
unsigned long ms_entries;
} MDB_stat;
+char *mdb_version(int *major, int *minor, int *patch);
int mdb_env_create(MDB_env **env);
int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode);
int mdb_env_stat(MDB_env *env, MDB_stat *stat);
-int mdb_env_sync(MDB_env *env);
+int mdb_env_sync(MDB_env *env, int force);
void mdb_env_close(MDB_env *env);
int mdb_env_get_flags(MDB_env *env, unsigned int *flags);
int mdb_env_get_path(MDB_env *env, const char **path);