Call SetShmBase() in init_rs
The ShmEventLoop rust test was using /dev/shm/aos and breaking out of
the sandbox. Fix that.
Change-Id: I14db8b500a03a66fef41399c4cea334ff79b217f
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/BUILD b/aos/events/BUILD
index a09c3d8..c398e7b 100644
--- a/aos/events/BUILD
+++ b/aos/events/BUILD
@@ -460,6 +460,7 @@
"//aos:init",
"//aos:realtime",
"//aos/ipc_lib:lockless_queue",
+ "//aos/ipc_lib:shm_base",
"//aos/ipc_lib:signalfd",
"//aos/stl_mutex",
"//aos/util:phased_loop",
@@ -622,7 +623,7 @@
rustc_flags = ["-Crelocation-model=static"],
deps = [
":ping_rust_fbs",
- "//aos:init_rs",
+ "//aos:test_init_rs",
"@crate_index//:futures",
"@rules_rust//tools/runfiles",
],
@@ -672,7 +673,7 @@
}),
deps = [
":ping_rust_fbs",
- "//aos:init_rs",
+ "//aos:test_init_rs",
"@crate_index//:futures",
"@rules_rust//tools/runfiles",
],
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index 0dc23d9..3126265 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -38,8 +38,6 @@
} // namespace
-DEFINE_string(shm_base, "/dev/shm/aos",
- "Directory to place queue backing mmaped files in.");
// This value is affected by the umask of the process which is calling it
// and is set to the user's value by default (check yours running `umask` on
// the command line).
@@ -59,10 +57,6 @@
using namespace shm_event_loop_internal;
-void SetShmBase(const std::string_view base) {
- FLAGS_shm_base = std::string(base) + "/aos";
-}
-
namespace {
const Node *MaybeMyNode(const Configuration *configuration) {
diff --git a/aos/events/shm_event_loop.h b/aos/events/shm_event_loop.h
index 7b7e68f..0e71f96 100644
--- a/aos/events/shm_event_loop.h
+++ b/aos/events/shm_event_loop.h
@@ -8,11 +8,11 @@
#include "aos/events/epoll.h"
#include "aos/events/event_loop.h"
#include "aos/events/event_loop_generated.h"
+#include "aos/ipc_lib/shm_base.h"
#include "aos/ipc_lib/signalfd.h"
#include "aos/stl_mutex/stl_mutex.h"
DECLARE_string(application_name);
-DECLARE_string(shm_base);
namespace aos {
namespace shm_event_loop_internal {
diff --git a/aos/events/shm_event_loop.rs b/aos/events/shm_event_loop.rs
index 3e387ef..880f72b 100644
--- a/aos/events/shm_event_loop.rs
+++ b/aos/events/shm_event_loop.rs
@@ -233,7 +233,7 @@
use aos_configuration::read_config_from;
use aos_events_event_loop_runtime::{Sender, Watcher};
- use aos_init::test_init;
+ use aos_test_init::test_init;
use ping_rust_fbs::aos::examples as ping;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Barrier;
diff --git a/aos/events/simulated_event_loop.rs b/aos/events/simulated_event_loop.rs
index ea3a154..90c4c86 100644
--- a/aos/events/simulated_event_loop.rs
+++ b/aos/events/simulated_event_loop.rs
@@ -143,7 +143,7 @@
use runfiles::Runfiles;
use aos_configuration::read_config_from;
- use aos_init::test_init;
+ use aos_test_init::test_init;
use ping_rust_fbs::aos::examples::PingBuilder;
// A really basic test of the functionality here.