32#include "RConfigure.h"
41#include <netinet/in.h>
64#include "compiledata.h"
85 fServ->HandleUrgentData();
108 fServ->HandleSigPipe();
128 Printf(
"TProofServLiteTerminationHandler::Notify: wake up!");
130 fServ->HandleTermination();
151 Printf(
"**** Segmentation violation: terminating ****");
153 fServ->HandleTermination();
174 fServ->HandleSocketInput();
206 Info(
"CreateServer",
"starting server creation");
212 Error(
"CreateServer",
"resolving the log file description number");
220 Error(
"CreateServer",
"Socket setup by xpd undefined");
223 TString entity =
gEnv->GetValue(
"ProofServ.Entity",
"");
230 Error(
"CreateServer",
"Failed to open connection to the client");
248 if (
gEnv->GetValue(
"Proof.GdbHook",0) == 2) {
254 Info(
"CreateServer",
"Service: %s, ConfDir: %s, IsMaster: %d",
281 logon =
gEnv->GetValue(
"Proof.Load", (
char *)0);
290 logon =
gEnv->GetValue(
"Proof.Logon", (
char *)0);
343 snprintf(str, 512,
"**** Welcome to the PROOF server @ %s ****",
gSystem->HostName());
345 snprintf(str, 512,
"**** PROOF worker server @ %s started ****",
gSystem->HostName());
348 if (
fSocket->Send(str) != 1+
static_cast<Int_t>(strlen(str))) {
349 Error(
"Setup",
"failed to send proof server startup message");
354 if ((
fProtocol =
gEnv->GetValue(
"ProofServ.ClientVersion", -1)) < 0) {
355 Error(
"Setup",
"remote proof protocol missing");
384 if ((
fSessionDir =
gEnv->GetValue(
"ProofServ.SessionDir",
"-1")) ==
"-1") {
385 Error(
"Setup",
"Session dir missing");
390 if (
gSystem->Getenv(
"ROOTPROOFLOGFILE")) {
401 Info(
"Setup",
"working directory set to %s",
fWorkDir.Data());
405 Error(
"Setup",
"common setup failed");
436 Info(
"Terminate",
"starting session termination operations ...");
450 Info(
"Terminate",
"data directory '%s' has been removed",
fDataDir.Data());
461 Printf(
"Terminate: termination operations ended: quitting!");
470 Error(
"HandleFork",
"empty message!");
478 Info(
"HandleFork",
"cloning to %s", clones.
Data());
486 if ((rc =
Fork()) < 0) {
487 Error(
"HandleFork",
"failed to fork %s",
clone.Data());
509 Info(
"SetupOnFork",
"finalizing setup of %s", ord);
533 void *dirp =
gSystem->OpenDirectory(sdir);
537 while ((
e =
gSystem->GetDirEntry(dirp))) {
543 Info(
"SetupOnFork",
"unlinking: %s", ent.
Data());
557 gSystem->Setenv(
"ROOTPROOFLOGFILE", logfile);
566 Error(
"CreateServer",
"Socket setup by xpd undefined");
569 TString entity =
gEnv->GetValue(
"ProofServ.Entity",
"");
576 Error(
"CreateServer",
"Failed to open connection to the client");
594 if (
gEnv->GetValue(
"Proof.GdbHook",0) == 2) {
600 Info(
"SetupOnFork",
"Service: %s, ConfDir: %s, IsMaster: %d",
TObject * clone(const char *newname) const override
R__EXTERN void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set.
R__EXTERN Int_t gProofDebugLevel
TApplication * GetTProofServLite(Int_t *argc, char **argv, FILE *flog)
static volatile Int_t gProofServDebug
const char *const kPROOF_WorkDir
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
@ kSigSegmentationViolation
R__EXTERN TSystem * gSystem
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual Longptr_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=nullptr)
Process a single command line, either a C++ statement or an interpreter command starting with a "....
virtual Longptr_t ProcessFile(const char *file, Int_t *error=nullptr, Bool_t keep=kFALSE)
Process a file containing a C++ macro.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Bool_t Notify() override
Handle urgent data.
TProofServLiteInterruptHandler(TProofServLite *s)
TProofServLiteSegViolationHandler(TProofServLite *s)
Bool_t Notify() override
Handle seg violation.
TProofServLiteSigPipeHandler(TProofServLite *s)
Bool_t Notify() override
Handle sig pipe.
TProofServLiteTerminationHandler(TProofServLite *s)
Bool_t Notify() override
Handle termination.
Version of the PROOF worker server for local running.
void HandleSigPipe() override
Called when the client is not alive anymore; terminate the session.
~TProofServLite() override
Cleanup.
Int_t Setup() override
Print the ProofServ logo on standard output.
TProofServLiteInterruptHandler * fInterruptHandler
Int_t SetupOnFork(const char *ord)
Finalize the server setup afetr forking.
void HandleFork(TMessage *mess) override
Cloning itself via fork.
void HandleTermination() override
Called when the client is not alive anymore; terminate the session.
void Terminate(Int_t status) override
Terminate the proof server.
Int_t CreateServer() override
Finalize the server setup.
void FlushLogFile()
Reposition the read pointer in the log file to the very end.
void RedirectOutput(const char *dir=0, const char *mode="w")
Redirect stdout to a log file.
Int_t SetupCommon()
Common part (between TProofServ and TXProofServ) of the setup phase.
TProofServ(Int_t *argc, char **argv, FILE *flog=0)
Main constructor.
friend class TProofServLite
virtual Int_t Fork()
Fork a child.
Bool_t UnlinkDataDir(const char *path)
Scan recursively the datadir and unlink it if empty Return kTRUE if it can be unlinked,...
virtual void SendLogFile(Int_t status=0, Int_t start=-1, Int_t end=-1)
Send log file to master.
static const char * GetMacroPath()
Get macro search path. Static utility function.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
ESignals GetSignal() const
This class implements client sockets.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
The TTimeStamp encapsulates seconds and ns since EPOCH.