Move Flare/Pipe from the bro namespace to zeek::detail

This commit is contained in:
Tim Wojtulewicz 2020-05-20 14:06:38 -07:00
parent 60ed29c3b6
commit 4a1b39a2be
9 changed files with 18 additions and 19 deletions

View file

@ -145,7 +145,7 @@ protected:
analyzer::ID current_aid;
RecordVal* src_val;
bool draining;
bro::Flare queue_flare;
zeek::detail::Flare queue_flare;
};
extern EventMgr mgr;

View file

@ -6,7 +6,7 @@
#include <fcntl.h>
#include <errno.h>
using namespace bro;
using namespace zeek::detail;
Flare::Flare()
: pipe(FD_CLOEXEC, FD_CLOEXEC, O_NONBLOCK, O_NONBLOCK)

View file

@ -4,7 +4,7 @@
#include "Pipe.h"
namespace bro {
namespace zeek::detail {
class Flare {
public:
@ -21,8 +21,7 @@ public:
* @return a file descriptor that will become ready if the flare has been
* Fire()'d and not yet Extinguished()'d.
*/
int FD() const
{ return pipe.ReadFD(); }
int FD() const { return pipe.ReadFD(); }
/**
* Put the object in the "ready" state.
@ -44,4 +43,4 @@ private:
Pipe pipe;
};
} // namespace bro
} // namespace zeek::detail

View file

@ -7,7 +7,7 @@
#include <errno.h>
#include <cstdio>
using namespace bro;
using namespace zeek::detail;
static void pipe_fail(int eno)
{

View file

@ -2,7 +2,7 @@
#pragma once
namespace bro {
namespace zeek::detail {
class Pipe {
public:
@ -136,4 +136,4 @@ private:
bool swapped = false;
};
} // namespace bro
} // namespace zeek::detail

View file

@ -178,7 +178,7 @@ private:
double GetNextTimeout() override { return -1; }
private:
bro::Flare flare;
zeek::detail::Flare flare;
};
struct Source {

View file

@ -83,8 +83,8 @@ struct Stem {
pid_t parent_pid;
int last_signal = -1;
std::unique_ptr<bro::Flare> signal_flare;
std::unique_ptr<bro::PipePair> pipe;
std::unique_ptr<zeek::detail::Flare> signal_flare;
std::unique_ptr<zeek::detail::PipePair> pipe;
std::map<std::string, Supervisor::Node> nodes;
std::string msg_buffer;
bool shutting_down = false;
@ -426,7 +426,7 @@ size_t Supervisor::ProcessMessages()
}
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");
pipe->Swap();
@ -928,7 +928,7 @@ std::optional<Supervisor::StemState> Supervisor::CreateStem(bool supervisor_mode
fds[i] = std::stoi(zeek_stem_nums[i + 1]);
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;
zeek::Supervisor::RunStem(std::move(ss));
return {};
@ -938,7 +938,7 @@ std::optional<Supervisor::StemState> Supervisor::CreateStem(bool supervisor_mode
return {};
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.pid = fork();

View file

@ -241,7 +241,7 @@ public:
/**
* 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).
*/
@ -382,9 +382,9 @@ private:
Config config;
pid_t stem_pid;
std::unique_ptr<bro::PipePair> stem_pipe;
std::unique_ptr<zeek::detail::PipePair> stem_pipe;
int last_signal = -1;
bro::Flare signal_flare;
zeek::detail::Flare signal_flare;
NodeMap nodes;
std::string msg_buffer;
};

View file

@ -338,7 +338,7 @@ private:
bool child_sent_finish; // Child thread asked to be finished.
bool failed; // Set to true when a command failed.
bro::Flare flare;
zeek::detail::Flare flare;
};
/**