From 16be05e5300f647b8a7f281cad2133697446fe62 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 18 May 2017 13:37:08 -0500 Subject: [PATCH] Optional session label for Rtc connection constructor Ref #2410 --- repos/os/include/rtc_session/connection.h | 5 +++-- repos/os/run/rtc.run | 1 + repos/os/src/test/rtc/main.cc | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/repos/os/include/rtc_session/connection.h b/repos/os/include/rtc_session/connection.h index 7db908c231..5252ff4433 100644 --- a/repos/os/include/rtc_session/connection.h +++ b/repos/os/include/rtc_session/connection.h @@ -26,9 +26,10 @@ struct Rtc::Connection : Genode::Connection, Session_client /** * Constructor */ - Connection(Genode::Env &env) + Connection(Genode::Env &env, char const *label = "") : - Genode::Connection(env, session(env.parent(), "ram_quota=8K")), + Genode::Connection( + env, session(env.parent(), "ram_quota=8K, label=\"%s\"", label)), Session_client(cap()) { } diff --git a/repos/os/run/rtc.run b/repos/os/run/rtc.run index b7b0d3f1d5..02aacf50f8 100644 --- a/repos/os/run/rtc.run +++ b/repos/os/run/rtc.run @@ -20,6 +20,7 @@ install_config { + diff --git a/repos/os/src/test/rtc/main.cc b/repos/os/src/test/rtc/main.cc index 3e0182ec7a..b360f9e5fe 100644 --- a/repos/os/src/test/rtc/main.cc +++ b/repos/os/src/test/rtc/main.cc @@ -16,6 +16,7 @@ #include #include + using namespace Genode; struct Main @@ -25,14 +26,16 @@ struct Main Genode::log("--- RTC test started ---"); /* open sessions */ - Rtc::Connection rtc(env); + Rtc::Connection rtc[] = { { env }, { env, "with_label" } }; Timer::Connection timer(env); for (unsigned i = 0; i < 4; ++i) { - Rtc::Timestamp now = rtc.current_time(); + Rtc::Timestamp now[] = { rtc[0].current_time(), rtc[1].current_time() }; - log("RTC: ", now.year, "-", now.month, "-", now.day, " ", - now.hour, ":", now.minute, ":", now.second); + for (unsigned j = 0; j < sizeof(rtc)/sizeof(*rtc); ++j) + log("RTC[", j, "]: ", + now[j].year, "-", now[j].month, "-", now[j].day, " ", + now[j].hour, ":", now[j].minute, ":", now[j].second); timer.msleep(1000); }