mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Move Flare/Pipe from the bro namespace to zeek::detail
This commit is contained in:
parent
60ed29c3b6
commit
4a1b39a2be
9 changed files with 18 additions and 19 deletions
|
@ -145,7 +145,7 @@ protected:
|
||||||
analyzer::ID current_aid;
|
analyzer::ID current_aid;
|
||||||
RecordVal* src_val;
|
RecordVal* src_val;
|
||||||
bool draining;
|
bool draining;
|
||||||
bro::Flare queue_flare;
|
zeek::detail::Flare queue_flare;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventMgr mgr;
|
extern EventMgr mgr;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
using namespace bro;
|
using namespace zeek::detail;
|
||||||
|
|
||||||
Flare::Flare()
|
Flare::Flare()
|
||||||
: pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK)
|
: pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "Pipe.h"
|
#include "Pipe.h"
|
||||||
|
|
||||||
namespace bro {
|
namespace zeek::detail {
|
||||||
|
|
||||||
class Flare {
|
class Flare {
|
||||||
public:
|
public:
|
||||||
|
@ -21,8 +21,7 @@ public:
|
||||||
* @return a file descriptor that will become ready if the flare has been
|
* @return a file descriptor that will become ready if the flare has been
|
||||||
* Fire()'d and not yet Extinguished()'d.
|
* Fire()'d and not yet Extinguished()'d.
|
||||||
*/
|
*/
|
||||||
int FD() const
|
int FD() const { return pipe.ReadFD(); }
|
||||||
{ return pipe.ReadFD(); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the object in the "ready" state.
|
* Put the object in the "ready" state.
|
||||||
|
@ -44,4 +43,4 @@ private:
|
||||||
Pipe pipe;
|
Pipe pipe;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace bro
|
} // namespace zeek::detail
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
using namespace bro;
|
using namespace zeek::detail;
|
||||||
|
|
||||||
static void pipe_fail(int eno)
|
static void pipe_fail(int eno)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace bro {
|
namespace zeek::detail {
|
||||||
|
|
||||||
class Pipe {
|
class Pipe {
|
||||||
public:
|
public:
|
||||||
|
@ -136,4 +136,4 @@ private:
|
||||||
bool swapped = false;
|
bool swapped = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace bro
|
} // namespace zeek::detail
|
||||||
|
|
|
@ -178,7 +178,7 @@ private:
|
||||||
double GetNextTimeout() override { return -1; }
|
double GetNextTimeout() override { return -1; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bro::Flare flare;
|
zeek::detail::Flare flare;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Source {
|
struct Source {
|
||||||
|
|
|
@ -83,8 +83,8 @@ struct Stem {
|
||||||
|
|
||||||
pid_t parent_pid;
|
pid_t parent_pid;
|
||||||
int last_signal = -1;
|
int last_signal = -1;
|
||||||
std::unique_ptr<bro::Flare> signal_flare;
|
std::unique_ptr<zeek::detail::Flare> signal_flare;
|
||||||
std::unique_ptr<bro::PipePair> pipe;
|
std::unique_ptr<zeek::detail::PipePair> pipe;
|
||||||
std::map<std::string, Supervisor::Node> nodes;
|
std::map<std::string, Supervisor::Node> nodes;
|
||||||
std::string msg_buffer;
|
std::string msg_buffer;
|
||||||
bool shutting_down = false;
|
bool shutting_down = false;
|
||||||
|
@ -426,7 +426,7 @@ size_t Supervisor::ProcessMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
Stem::Stem(Supervisor::StemState ss)
|
Stem::Stem(Supervisor::StemState ss)
|
||||||
: parent_pid(ss.parent_pid), signal_flare(new bro::Flare()), pipe(std::move(ss.pipe))
|
: parent_pid(ss.parent_pid), signal_flare(new zeek::detail::Flare()), pipe(std::move(ss.pipe))
|
||||||
{
|
{
|
||||||
zeek::set_thread_name("zeek.stem");
|
zeek::set_thread_name("zeek.stem");
|
||||||
pipe->Swap();
|
pipe->Swap();
|
||||||
|
@ -928,7 +928,7 @@ std::optional<Supervisor::StemState> Supervisor::CreateStem(bool supervisor_mode
|
||||||
fds[i] = std::stoi(zeek_stem_nums[i + 1]);
|
fds[i] = std::stoi(zeek_stem_nums[i + 1]);
|
||||||
|
|
||||||
StemState ss;
|
StemState ss;
|
||||||
ss.pipe = std::make_unique<bro::PipePair>(FD_CLOEXEC, O_NONBLOCK, fds);
|
ss.pipe = std::make_unique<zeek::detail::PipePair>(FD_CLOEXEC, O_NONBLOCK, fds);
|
||||||
ss.parent_pid = stem_ppid;
|
ss.parent_pid = stem_ppid;
|
||||||
zeek::Supervisor::RunStem(std::move(ss));
|
zeek::Supervisor::RunStem(std::move(ss));
|
||||||
return {};
|
return {};
|
||||||
|
@ -938,7 +938,7 @@ std::optional<Supervisor::StemState> Supervisor::CreateStem(bool supervisor_mode
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
StemState ss;
|
StemState ss;
|
||||||
ss.pipe = std::make_unique<bro::PipePair>(FD_CLOEXEC, O_NONBLOCK);
|
ss.pipe = std::make_unique<zeek::detail::PipePair>(FD_CLOEXEC, O_NONBLOCK);
|
||||||
ss.parent_pid = getpid();
|
ss.parent_pid = getpid();
|
||||||
ss.pid = fork();
|
ss.pid = fork();
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Bidirectional pipes that allow the Supervisor and Stem to talk.
|
* Bidirectional pipes that allow the Supervisor and Stem to talk.
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<bro::PipePair> pipe;
|
std::unique_ptr<zeek::detail::PipePair> pipe;
|
||||||
/**
|
/**
|
||||||
* The Stem's parent process ID (i.e. PID of the Supervisor).
|
* The Stem's parent process ID (i.e. PID of the Supervisor).
|
||||||
*/
|
*/
|
||||||
|
@ -382,9 +382,9 @@ private:
|
||||||
|
|
||||||
Config config;
|
Config config;
|
||||||
pid_t stem_pid;
|
pid_t stem_pid;
|
||||||
std::unique_ptr<bro::PipePair> stem_pipe;
|
std::unique_ptr<zeek::detail::PipePair> stem_pipe;
|
||||||
int last_signal = -1;
|
int last_signal = -1;
|
||||||
bro::Flare signal_flare;
|
zeek::detail::Flare signal_flare;
|
||||||
NodeMap nodes;
|
NodeMap nodes;
|
||||||
std::string msg_buffer;
|
std::string msg_buffer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -338,7 +338,7 @@ private:
|
||||||
bool child_sent_finish; // Child thread asked to be finished.
|
bool child_sent_finish; // Child thread asked to be finished.
|
||||||
bool failed; // Set to true when a command failed.
|
bool failed; // Set to true when a command failed.
|
||||||
|
|
||||||
bro::Flare flare;
|
zeek::detail::Flare flare;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue