]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb/tdb_private.h
Tracing for tdb operations.
[ccan] / ccan / tdb / tdb_private.h
index ffac89ff0e315195b3defdebc35184ef7ab6a038..e3ec695642d06263e79c62e8ed7ce98a5505ebb8 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef TDB_PRIVATE_H
+#define TDB_PRIVATE_H
  /* 
    Unix SMB/CIFS implementation.
 
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifdef _SAMBA_BUILD_
 #include "replace.h"
 #include "system/filesys.h"
 #include "system/time.h"
 #include "system/shmem.h"
 #include "system/select.h"
 #include "system/wait.h"
+#else
+#define _XOPEN_SOURCE 500
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <utime.h>
+#include "config.h"
+#endif
 #include "tdb.h"
 
-#ifndef HAVE_GETPAGESIZE
+#if HAVE_GETPAGESIZE
 #define getpagesize() 0x2000
 #endif
 
@@ -68,6 +86,18 @@ typedef uint32_t tdb_off_t;
  * argument. */
 #define TDB_LOG(x) tdb->log.log_fn x
 
+#ifdef TDB_TRACE
+void tdb_trace(const struct tdb_context *tdb, const char *fmt, ...);
+void tdb_trace_record(const struct tdb_context *tdb, TDB_DATA rec);
+#else
+static inline void tdb_trace(const struct tdb_context *tdb, const char *fmt, ...)
+{
+}
+static inline void tdb_trace_record(const struct tdb_context *tdb, TDB_DATA rec)
+{
+}
+#endif /* !TDB_TRACE */
+
 /* lock offsets */
 #define GLOBAL_LOCK      0
 #define ACTIVE_LOCK      4
@@ -167,6 +197,7 @@ struct tdb_context {
        int page_size;
        int max_dead_records;
        bool have_transaction_lock;
+       int tracefd;
        volatile sig_atomic_t *interrupt_sig_ptr;
 };
 
@@ -211,3 +242,4 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off,
                      struct list_struct *rec);
 
 
+#endif