mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Initial structure for supervisor-mode
The full process hierarchy isn't set up yet, but these changes help prepare by doing two things: - Add a -j option to enable supervisor-mode. Currently, just a single "stem" process gets forked early on to be used as the basis for further forking into real cluster nodes. - Separates the parsing of command-line options from their consumption. i.e. need to parse whether we're in -j supervisor-mode before modifying any global state since that would taint the "stem" process. The new intermediate structure containing the parsed options may also serve as a way to pass configuration info from "stem" to its descendent cluster node processes.
This commit is contained in:
parent
d97d625bc3
commit
4959d438fa
18 changed files with 751 additions and 366 deletions
17
src/Flare.cc
17
src/Flare.cc
|
@ -17,7 +17,14 @@ static void bad_pipe_op(const char* which)
|
|||
{
|
||||
char buf[256];
|
||||
bro_strerror_r(errno, buf, sizeof(buf));
|
||||
reporter->FatalErrorWithCore("unexpected pipe %s failure: %s", which, buf);
|
||||
|
||||
if ( reporter )
|
||||
reporter->FatalErrorWithCore("unexpected pipe %s failure: %s", which, buf);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "unexpected pipe %s failure: %s", which, buf);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void Flare::Fire()
|
||||
|
@ -49,8 +56,9 @@ void Flare::Fire()
|
|||
}
|
||||
}
|
||||
|
||||
void Flare::Extinguish()
|
||||
int Flare::Extinguish()
|
||||
{
|
||||
int rval = 0;
|
||||
char tmp[256];
|
||||
|
||||
for ( ; ; )
|
||||
|
@ -58,8 +66,11 @@ void Flare::Extinguish()
|
|||
int n = read(pipe.ReadFD(), &tmp, sizeof(tmp));
|
||||
|
||||
if ( n >= 0 )
|
||||
{
|
||||
rval += n;
|
||||
// Pipe may not be empty yet: try again.
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( errno == EAGAIN )
|
||||
// Success: pipe is now empty.
|
||||
|
@ -71,4 +82,6 @@ void Flare::Extinguish()
|
|||
|
||||
bad_pipe_op("read");
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue