#include "misc.hh"
#include "gettime.hh"
#include <thread>
+#include "dolog.hh"
template<class T>
ObjectPipe<T>::ObjectPipe()
template<class T>
void DelayPipe<T>::worker()
{
+ string threadName = "dnsdist/delayPi";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for DelayPipe worker thread: %s", threadName, strerror(retval));
+ }
Combo c;
for(;;) {
/* this code is slightly too subtle, but I don't see how it could be any simpler.
void* carbonDumpThread()
try
{
+ string threadName = "dnsdist/carbon";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for carbon thread: %s", threadName, strerror(retval));
+ }
auto localCarbon = g_carbon.getLocal();
for(int numloops=0;;++numloops) {
if(localCarbon->empty()) {
static void controlClientThread(int fd, ComboAddress client)
try
{
+ string threadname = "dnsdist/conscli";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadname.c_str()));
+ if (retval != 0) {
+ warnlog("could not set thread name %s for control client thread: %s", threadname, strerror(retval));
+ }
setTCPNoDelay(fd);
SodiumNonce theirs, ours, readingNonce, writingNonce;
ours.init();
void controlThread(int fd, ComboAddress local)
try
{
+ string threadName = "dnsdist/control";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for control console thread: %s", threadName, strerror(retval));
+ }
ComboAddress client;
int sock;
auto localACL = g_consoleACL.getLocal();
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <pthread.h>
#include "dnsdist.hh"
#include "dnsdist-ecs.hh"
#include "dnsdist-lua.hh"
void TeeAction::worker()
{
+ string threadName = "dnsdist/TeeWork";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for TeeAction worker thread: %s", threadName, strerror(retval));
+ }
char packet[1500];
int res=0;
struct dnsheader* dh=(struct dnsheader*)packet;
/* we get launched with a pipe on which we receive file descriptors from clients that we own
from that point on */
+ string threadName = "dnsdist/tcpClie";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for TCP Client thread: %s", threadName, strerror(retval));
+ }
+
bool outstanding = false;
time_t lastTCPCleanup = time(nullptr);
*/
void* tcpAcceptorThread(void* p)
{
+ string threadName = "dnsdist/tcpAcce";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for TCP acceptor thread: %s", threadName, strerror(retval));
+ }
ClientState* cs = (ClientState*) p;
bool tcpClientCountIncremented = false;
ComboAddress remote;
#include "ext/incbin/incbin.h"
#include "dolog.hh"
#include <thread>
+#include <pthread.h>
#include <sstream>
#include <yahttp/yahttp.hpp>
#include "namespaces.hh"
static void connectionThread(int sock, ComboAddress remote, string password, string apiKey, const boost::optional<std::map<std::string, std::string> >& customHeaders)
{
+ string threadName = "dnsdist/webConn";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for webserver connection thread: %s", threadName, strerror(retval));
+ }
+
using namespace json11;
vinfolog("Webserver handling connection from %s", remote.toStringWithPort());
}
void dnsdistWebserverThread(int sock, const ComboAddress& local, const std::string& password, const std::string& apiKey, const boost::optional<std::map<std::string, std::string> >& customHeaders)
{
+ string threadName = "dnsdist/webserv";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for webserver thread: %s", threadName, strerror(retval));
+ }
warnlog("Webserver launched on %s", local.toStringWithPort());
for(;;) {
try {
// listens on a dedicated socket, lobs answers from downstream servers to original requestors
void* responderThread(std::shared_ptr<DownstreamState> dss)
try {
+ string threadName = "dnsdist/respond";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for responder thread: %s", threadName, strerror(retval));
+ }
auto localRespRulactions = g_resprulactions.getLocal();
#ifdef HAVE_DNSCRYPT
char packet[4096 + DNSCRYPT_MAX_RESPONSE_PADDING_AND_MAC_SIZE];
static void* udpClientThread(ClientState* cs)
try
{
+ string threadName = "dnsdist/udpClie";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for UDP client thread: %s", threadName, strerror(retval));
+ }
LocalHolders holders;
#if defined(HAVE_RECVMMSG) && defined(HAVE_SENDMMSG) && defined(MSG_WAITFORONE)
void* maintThread()
{
+ string threadName = "dnsdist/main";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for main thread: %s", threadName, strerror(retval));
+ }
int interval = 1;
size_t counter = 0;
int32_t secondsToWaitLog = 0;
void* healthChecksThread()
{
+ string threadName = "dnsdist/healthC";
+ auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+ if (retval != 0) {
+ warnlog("Could not set thread name %s for health check thread: %s", threadName, strerror(retval));
+ }
+
int interval = 1;
for(;;) {
void RemoteLogger::worker()
{
+#ifdef WE_ARE_RECURSOR
string threadName = "pdns-r/remLog";
+#else
+ string threadName = "dnsdist/remLog";
+#endif
auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
if (retval != 0) {
+#ifdef WE_ARE_RECURSOR
g_log<<Logger::Warning<<"Could not set thread name "<<threadName<<" for Remote Logger thread: "<<strerror(retval)<<endl;
+#else
+ warnlog("Could not set thread name %s for Remote Logger thread: %s", threadName, strerror(retval));
+#endif
}
while(true) {
std::string data;
#include "snmp-agent.hh"
#include "misc.hh"
+#ifdef RECURSOR
#include "logger.hh"
+#else
+#include "dolog.hh"
+#endif
#ifdef HAVE_NET_SNMP
throw std::runtime_error("No FD multiplexer found for the SNMP agent!");
}
+#ifdef RECURSOR
string threadName = "pdns-r/SNMP";
+#else
+ string threadName = "dnsdist/SNMP";
+#endif
auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
if (retval != 0) {
+#ifdef RECURSOR
g_log<<Logger::Warning<<"Could not set thread name "<<threadName<<" for SNMP thread: "<<strerror(retval)<<endl;
+#else
+ warnlog("Could not set thread name %s for SNMP thread: %s", threadName, strerror(retval));
+#endif
}
int maxfd = 0;