#endif
#endif
+#if __SANITIZE_THREAD__
+#if defined __has_include
+#if __has_include(<sanitizer/tsan_interface.h>)
+#include <sanitizer/tsan_interface.h>
+#else /* __has_include(<sanitizer/tsan_interface.h>) */
+extern "C" void __tsan_acquire(void* addr);
+extern "C" void __tsan_release(void* addr);
+#endif /* __has_include(<sanitizer/tsan_interface.h>) */
+#else /* defined __has_include */
+extern "C" void __tsan_acquire(void* addr);
+extern "C" void __tsan_release(void* addr);
+#endif /* defined __has_include */
+#else
+#error XXXX
+#define __tsan_acquire(x)
+#define __tsan_release(x)
+#endif /* __SANITIZE_THREAD__ */
+
string g_programname = "pdns_recursor";
string g_pidfname;
RecursorControlChannel g_rcc; // only active in the handler thread
ThreadMSG* tmsg = new ThreadMSG(); // NOLINT: manual ownership handling
tmsg->func = func;
tmsg->wantAnswer = true;
+
+ __tsan_release(tmsg);
+
if (write(threadInfo.getPipes().writeToThread, &tmsg, sizeof(tmsg)) != sizeof(tmsg)) { // NOLINT: sizeof correct
+
+ __tsan_acquire(tmsg);
+
delete tmsg; // NOLINT: manual ownership handling
unixDie("write to thread pipe returned wrong size or error");
unixDie("read from thread pipe returned wrong size or error");
}
+ __tsan_acquire(resp);
+
if (resp != nullptr) {
delete resp; // NOLINT: manual ownership handling
resp = nullptr;
tmsg->func = [func] { return voider<T>(func); };
tmsg->wantAnswer = true;
+ __tsan_release(tmsg);
+
if (write(tps.writeToThread, &tmsg, sizeof(tmsg)) != sizeof(tmsg)) { // NOLINT:: sizeof correct
+
+ __tsan_acquire(tmsg);
+
delete tmsg; // NOLINT: manual ownership handling
unixDie("write to thread pipe returned wrong size or error");
}
if (read(tps.readFromThread, &resp, sizeof(resp)) != sizeof(resp)) // NOLINT: sizeof correct
unixDie("read from thread pipe returned wrong size or error");
+ __tsan_acquire(resp);
+
if (resp) {
ret += *resp;
delete resp; // NOLINT: manual ownership handling
unixDie("read from thread pipe returned wrong size or error");
}
+ __tsan_acquire(tmsg);
+
void* resp = nullptr;
try {
resp = tmsg->func();
g_rateLimitedLogger.log(g_slog->withName("runtime"), "PIPE function");
}
if (tmsg->wantAnswer) {
+
+ __tsan_release(resp);
+
if (write(RecThreadInfo::self().getPipes().writeFromThread, &resp, sizeof(resp)) != sizeof(resp)) {
delete tmsg; // NOLINT: manual ownership handling
unixDie("write to thread pipe returned wrong size or error");
daemon = sys.argv[1]
pdns_server = os.environ.get("PDNSSERVER", "../pdns/pdns_server")
-pdns_recursor = os.environ.get("PDNSRECURSOR", "../pdns/recursordist/pdns_recursor")
+pdns_recursor = os.environ.get("PDNSRECURSOR", "../pdns/recursordist/build/pdns_recursor")
common_args = [
"--daemon=no", "--socket-dir=.", "--config-dir=.",
"--local-address=127.0.0.1", "--local-port="+str(DNSPORT),