From 0dbfd9b04e2f0b94a342ff6b03a1e682487d5141 Mon Sep 17 00:00:00 2001 From: Tomer Lev Date: Wed, 21 Sep 2022 14:25:14 +0300 Subject: [PATCH] Building supervisor for window --- src/Val.h | 14 +++++++++----- src/supervisor/Supervisor.cc | 14 ++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Val.h b/src/Val.h index ab1eb46036..467c1361f4 100644 --- a/src/Val.h +++ b/src/Val.h @@ -1124,15 +1124,19 @@ public: AddedField(field); } - void Assign(int field, int new_val) + // For int types, we provide both [u]int32_t and [u]int64_t versions + // for convenience, since sometimes the caller has one rather + // than the other. + void Assign(int field, int32_t new_val) + { + (*record_val)[field] = ZVal(zeek_int_t(new_val)); + AddedField(field); + } + void Assign(int field, int64_t new_val) { (*record_val)[field] = ZVal(zeek_int_t(new_val)); AddedField(field); } - - // For unsigned, we provide both uint32_t and uint64_t versions - // for convenience, since sometimes the caller has one rather - // than the other. void Assign(int field, uint32_t new_val) { (*record_val)[field] = ZVal(zeek_uint_t(new_val)); diff --git a/src/supervisor/Supervisor.cc b/src/supervisor/Supervisor.cc index 2ae656b8c9..a2dc6a66ba 100644 --- a/src/supervisor/Supervisor.cc +++ b/src/supervisor/Supervisor.cc @@ -987,25 +987,23 @@ std::optional Stem::Poll() const auto total_fd_count = fixed_fd_count + (nodes.size() * 2); auto pfds = std::make_unique(total_fd_count); int pfd_idx = 0; - pfds[pfd_idx++] = {pipe->InFD(), POLLIN, 0}; - pfds[pfd_idx++] = {signal_flare->FD(), POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(pipe->InFD()), POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(signal_flare->FD()), POLLIN, 0}; -#if !defined(_MSC_VER) for ( const auto& [name, node] : nodes ) { node_pollfd_indices[name] = pfd_idx; if ( node.stdout_pipe.pipe ) - pfds[pfd_idx++] = {node.stdout_pipe.pipe->ReadFD(), POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(node.stdout_pipe.pipe->ReadFD()), POLLIN, 0}; else - pfds[pfd_idx++] = {-1, POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(-1), POLLIN, 0}; if ( node.stderr_pipe.pipe ) - pfds[pfd_idx++] = {node.stderr_pipe.pipe->ReadFD(), POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(node.stderr_pipe.pipe->ReadFD()), POLLIN, 0}; else - pfds[pfd_idx++] = {-1, POLLIN, 0}; + pfds[pfd_idx++] = {static_cast(-1), POLLIN, 0}; } -#endif // Note: the poll timeout here is for periodically checking if the parent // process died (see below).