Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def envoy_copts(repository, test = False):
}) + select({
repository + "//bazel:disable_signal_trace": [],
"//conditions:default": ["-DENVOY_HANDLE_SIGNALS"],
}) + select({
# TCLAP command line parser needs this to support int64_t/uint64_t
"@bazel_tools//tools/osx:darwin": ["-DHAVE_LONG_LONG"],
"//conditions:default": [],
})

# Compute the final linkopts based on various options.
Expand Down
14 changes: 14 additions & 0 deletions source/common/runtime/runtime_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <fcntl.h>
#include <unistd.h>

#ifdef __APPLE__
#include <uuid/uuid.h>
#endif

#include <cstdint>
#include <random>
#include <string>
Expand All @@ -22,6 +26,15 @@ namespace Runtime {
const size_t RandomGeneratorImpl::UUID_LENGTH = 36;

std::string RandomGeneratorImpl::uuid() {
#ifdef __APPLE__
// TODO(zuercher): factor out a sensible interface for UUID generation to make it easier
// to put a faster implementation in later.
char generated_uuid[UUID_LENGTH + 1];
uuid_t uuid;
uuid_generate_random(uuid);
uuid_unparse(uuid, generated_uuid);
return std::string(generated_uuid);
#else
int fd = open("/proc/sys/kernel/random/uuid", O_RDONLY);
if (-1 == fd) {
throw EnvoyException(fmt::format("unable to open uuid, errno: {}", strerror(errno)));
Expand All @@ -38,6 +51,7 @@ std::string RandomGeneratorImpl::uuid() {
}

return std::string(generated_uuid);
#endif
}

SnapshotImpl::SnapshotImpl(const std::string& root_path, const std::string& override_path,
Expand Down
1 change: 1 addition & 0 deletions source/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ InstanceImpl::InstanceImpl(Options& options, TestHooks& hooks, HotRestart& resta
} catch (const EnvoyException& e) {
ENVOY_LOG(critical, "error initializing configuration '{}': {}", options.configPath(),
e.what());
thread_local_.shutdownGlobalThreading();
thread_local_.shutdownThread();
exit(1);
}
Expand Down