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

@ -1003,7 +1003,7 @@ string bro_prefixes()
{
string rval;
for ( const auto& prefix : prefixes )
for ( const auto& prefix : zeek_script_prefixes )
{
if ( ! rval.empty() )
rval.append(":");
@ -1936,3 +1936,18 @@ string json_escape_utf8(const string& val)
return result;
}
void zeek::set_thread_name(const char* name, pthread_t tid)
{
#ifdef HAVE_LINUX
prctl(PR_SET_NAME, name, 0, 0, 0);
#endif
#ifdef __APPLE__
pthread_setname_np(name);
#endif
#ifdef __FreeBSD__
pthread_set_name_np(tid, name);
#endif
}