mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +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
|
@ -1,18 +1,11 @@
|
|||
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "zeek-config.h"
|
||||
#include "BasicThread.h"
|
||||
#include "Manager.h"
|
||||
#include "pthread.h"
|
||||
|
||||
#ifdef HAVE_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
#include "util.h"
|
||||
|
||||
using namespace threading;
|
||||
|
||||
|
@ -54,18 +47,7 @@ void BasicThread::SetName(const char* arg_name)
|
|||
void BasicThread::SetOSName(const char* arg_name)
|
||||
{
|
||||
static_assert(std::is_same<std::thread::native_handle_type, pthread_t>::value, "libstdc++ doesn't use pthread_t");
|
||||
|
||||
#ifdef HAVE_LINUX
|
||||
prctl(PR_SET_NAME, arg_name, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
pthread_setname_np(arg_name);
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
pthread_set_name_np(thread.native_handle(), arg_name);
|
||||
#endif
|
||||
zeek::set_thread_name(arg_name, thread.native_handle());
|
||||
}
|
||||
|
||||
const char* BasicThread::Fmt(const char* format, ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue