--- /dev/null
+#ifndef _DPRINTF_H
+#define _DPRINTF_H 1
+
+#include <stdio.h>
+
+extern bool use_debug;
+
+// Debug printf.
+#define dprintf(...) \
+ do { \
+ if (use_debug) { \
+ fprintf(stderr, __VA_ARGS__); \
+ } \
+ } while (false)
+
+#endif // !defined(_DPRINTF_H)
#ifndef WITHOUT_URING
#include <liburing.h>
#endif
+#include "dprintf.h"
#include "io_uring_engine.h"
#include <functional>
{
#ifdef WITHOUT_URING
int ret = -1;
+ dprintf("Compiled without liburing support; not using io_uring.\n");
#else
int ret = io_uring_queue_init(queue_depth, &ring, 0);
+ if (ret < 0) {
+ dprintf("io_uring_queue_init() failed; not using io_uring.\n");
+ }
#endif
using_uring = (ret >= 0);
}
#include "db.h"
+#include "dprintf.h"
#include "io_uring_engine.h"
#include "parse_trigrams.h"
#include "turbopfor.h"
using namespace std;
using namespace std::chrono;
-#define dprintf(...) \
- do { \
- if (use_debug) { \
- fprintf(stderr, __VA_ARGS__); \
- } \
- } while (false)
-
#define DEFAULT_DBPATH "/var/lib/mlocate/plocate.db"
const char *dbpath = DEFAULT_DBPATH;