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:
Jon Siwek 2019-09-27 18:53:07 -07:00
parent d97d625bc3
commit 4959d438fa
18 changed files with 751 additions and 366 deletions

View file

@ -231,7 +231,7 @@ void RuleMatcher::Delete(RuleHdrTest* node)
delete node;
}
bool RuleMatcher::ReadFiles(const name_list& files)
bool RuleMatcher::ReadFiles(const std::vector<std::string>& files)
{
#ifdef USE_PERFTOOLS_DEBUG
HeapLeakChecker::Disabler disabler;
@ -239,18 +239,18 @@ bool RuleMatcher::ReadFiles(const name_list& files)
parse_error = false;
for ( int i = 0; i < files.length(); ++i )
for ( const auto& f : files )
{
rules_in = open_file(find_file(files[i], bro_path(), ".sig"));
rules_in = open_file(find_file(f, bro_path(), ".sig"));
if ( ! rules_in )
{
reporter->Error("Can't open signature file %s", files[i]);
reporter->Error("Can't open signature file %s", f.data());
return false;
}
rules_line_number = 0;
current_rule_file = files[i];
current_rule_file = f.data();
rules_parse();
fclose(rules_in);
}