Optional session label for Rtc connection constructor

Ref #2410
This commit is contained in:
Emery Hemingway 2017-05-18 13:37:08 -05:00 committed by Christian Helmuth
parent 923fbc9e86
commit 16be05e530
3 changed files with 11 additions and 6 deletions

View File

@ -26,9 +26,10 @@ struct Rtc::Connection : Genode::Connection<Session>, Session_client
/**
* Constructor
*/
Connection(Genode::Env &env)
Connection(Genode::Env &env, char const *label = "")
:
Genode::Connection<Rtc::Session>(env, session(env.parent(), "ram_quota=8K")),
Genode::Connection<Rtc::Session>(
env, session(env.parent(), "ram_quota=8K, label=\"%s\"", label)),
Session_client(cap())
{ }

View File

@ -20,6 +20,7 @@ install_config {
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>

View File

@ -16,6 +16,7 @@
#include <rtc_session/connection.h>
#include <timer_session/connection.h>
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);
}