/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2003 - 2010 PowerDNS.COM BV
+ Copyright (C) 2003 - 2011 PowerDNS.COM BV
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
g_stats.maxMThreadStackUsage = max(MT->getMaxStackUsage(), g_stats.maxMThreadStackUsage);
}
-void makeControlChannelSocket()
+void makeControlChannelSocket(int processNum=-1)
{
- string sockname=::arg()["socket-dir"]+"/pdns_recursor.controlsocket";
+ string sockname=::arg()["socket-dir"]+"/pdns_recursor";
+ if(processNum >= 0)
+ sockname += "."+lexical_cast<string>(processNum);
+ sockname+=".controlsocket";
s_rcc.listen(sockname);
#ifndef WIN32
makeUDPServerSockets();
makeTCPServerSockets();
- for(int forks = 0; forks < ::arg().asNum("processes") - 1; ++forks) {
+ int forks;
+ for(forks = 0; forks < ::arg().asNum("processes") - 1; ++forks) {
if(!fork()) // we are child
break;
}
signal(SIGPIPE,SIG_IGN);
writePid();
#endif
- makeControlChannelSocket();
+ makeControlChannelSocket( ::arg().asNum("processes") > 1 ? forks : -1);
int newgid=0;
if(!::arg()["setgid"].empty())
}
Utility::dropPrivs(newuid, newgid);
-
-
g_numThreads = ::arg().asNum("threads") + ::arg().mustDo("pdns-distributes-queries");
makeThreadPipes();
/*
PowerDNS Versatile Database Driven Nameserver
- Copyright (C) 2006 PowerDNS.COM BV
+ Copyright (C) 2006 - 2011 PowerDNS.COM BV
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
arg().set("config-dir","Location of configuration directory (pdns.conf)")=SYSCONFDIR;
arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR;
- arg().set("socket-pid","When controlling multiple recursors, the target pid")="";
+ arg().set("process","When controlling multiple recursors, the target process number")="";
arg().set("timeout", "Number of seconds to wait for the recursor to respond")="5";
arg().setCmd("help","Provide this helpful message");
cerr<<arg().helpstring(arg()["help"])<<endl;
exit(99);
}
-
}
int main(int argc, char** argv)
initArguments(argc, argv);
RecursorControlChannel rccS;
- string sockname="pdns_recursor.controlsocket";
- if(!arg()["socket-pid"].empty())
- sockname+="."+arg()["socket-pid"];
+ string sockname="pdns_recursor";
+ if(!arg()["process"].empty())
+ sockname+="."+arg()["process"];
+
+ sockname.append(".controlsocket");
rccS.connect(arg()["socket-dir"], sockname);