#include <boost/container/flat_set.hpp>
#endif
#include "ws-recursor.hh"
+#include <thread>
#include <pthread.h>
#include "recpacketcache.hh"
#include "utility.hh"
}
}
-static void* recursorThread(unsigned int tid);
+static void* recursorThread(unsigned int tid, const string& threadName);
static void* pleaseSupplantACLs(std::shared_ptr<NetmaskGroup> ng)
{
/* This thread handles the web server, carbon, statistics and the control channel */
auto& handlerInfos = s_threadInfos.at(0);
handlerInfos.isHandler = true;
- handlerInfos.thread = std::thread(recursorThread, 0);
+ handlerInfos.thread = std::thread(recursorThread, 0, "main");
setCPUMap(cpusMap, currentThreadId, pthread_self());
auto& infos = s_threadInfos.at(currentThreadId);
infos.isListener = true;
infos.isWorker = true;
- recursorThread(currentThreadId++);
+ recursorThread(currentThreadId++, "worker");
}
else {
for(unsigned int n=0; n < g_numDistributorThreads; ++n) {
auto& infos = s_threadInfos.at(currentThreadId);
infos.isListener = true;
- infos.thread = std::thread(recursorThread, currentThreadId++);
+ infos.thread = std::thread(recursorThread, currentThreadId++, "distr");
setCPUMap(cpusMap, currentThreadId, infos.thread.native_handle());
}
auto& infos = s_threadInfos.at(currentThreadId);
infos.isListener = g_weDistributeQueries ? false : true;
infos.isWorker = true;
- infos.thread = std::thread(recursorThread, currentThreadId++);
+ infos.thread = std::thread(recursorThread, currentThreadId++, "worker");
setCPUMap(cpusMap, currentThreadId, infos.thread.native_handle());
}
/* This thread handles the web server, carbon, statistics and the control channel */
auto& infos = s_threadInfos.at(0);
infos.isHandler = true;
- infos.thread = std::thread(recursorThread, 0);
+ infos.thread = std::thread(recursorThread, 0, "web+stat");
s_threadInfos.at(0).thread.join();
}
return 0;
}
-static void* recursorThread(unsigned int n)
+static void* recursorThread(unsigned int n, const string& threadName)
try
{
t_id=n;
auto& threadInfo = s_threadInfos.at(t_id);
+
+ static string threadPrefix = "pdns-r/";
+
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>((threadPrefix + threadName).c_str()));
+ if (retval != 0) {
+ g_log<<Logger::Warning<<"Could not set thread name "<<threadPrefix<<threadName<<" for thread number "<<n<<": "<<strerror(retval)<<endl;
+ }
+
SyncRes tmp(g_now); // make sure it allocates tsstorage before we do anything, like primeHints or so..
SyncRes::setDomainMap(g_initialDomainMap);
t_allowFrom = g_initialAllowFrom;
+#include <pthread.h>
#include "dnsparser.hh"
#include "dnsrecords.hh"
#include "ixfr.hh"
void RPZIXFRTracker(const std::vector<ComboAddress> masters, boost::optional<DNSFilterEngine::Policy> defpol, uint32_t maxTTL, size_t zoneIdx, const TSIGTriplet& tt, size_t maxReceivedBytes, const ComboAddress& localAddress, const uint16_t axfrTimeout, std::shared_ptr<SOARecordContent> sr, std::string dumpZoneFileName, uint64_t configGeneration)
{
+ string threadName = "pdns-r/RPZIXFR";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ g_log<<Logger::Warning<<"Could not set thread name "<<threadName<<" for RPZ IXFRTracker thread: "<<strerror(retval)<<endl;
+ }
+
bool isPreloaded = sr != nullptr;
auto luaconfsLocal = g_luaconfs.getLocal();
/* we can _never_ modify this zone directly, we need to do a full copy then replace the existing zone */