Adaptation to Genode 17.05

- Adjust use of exceptions to unified exception types:
  https://genode.org/documentation/release-notes/17.05#Streamlining_exception_types
- Add posix.lib.so as boot module:
  http://genode.org/documentation/release-notes/17.05#POSIX_libc_profile_as_shared_library
- Adaptation to API changes

Ref #74
This commit is contained in:
Norman Feske
2017-06-02 11:24:27 +02:00
parent 0c7450c550
commit 670aab19e3
24 changed files with 37 additions and 42 deletions

View File

@@ -242,7 +242,6 @@ void Rom_hash::Main::handle_session_request(Xml_node request)
String<64> args("ram_quota=", ram_quota);
// XXX handle Root::Invalid_args
env.upgrade(session.client_id.id(), args.string());
env.parent().session_response(server_id, Parent::SESSION_OK);
});

View File

@@ -233,7 +233,7 @@ void Chroot::Main::handle_session_request(Xml_node request)
catch (...) {
if (session)
destroy(heap, session);
env.parent().session_response(server_id, Parent::INVALID_ARGS);
env.parent().session_response(server_id, Parent::SERVICE_DENIED);
}
}
@@ -245,7 +245,6 @@ void Chroot::Main::handle_session_request(Xml_node request)
String<64> args("ram_quota=", ram_quota);
// XXX handle Root::Invalid_args
env.upgrade(session.client_id.id(), args.string());
env.parent().session_response(server_id, Parent::SESSION_OK);
});

View File

@@ -75,9 +75,7 @@ class Log_tee::Root_component :
Log_tee::Session_component *_create_session(char const *args) override
{
Session_label const label = label_from_args(args);
try { return new (md_alloc()) Session_component(_env, label, args); }
catch (Genode::Parent::Service_denied) { throw Root::Unavailable(); }
return new (md_alloc()) Session_component(_env, label, args);
}
public:

View File

@@ -307,7 +307,7 @@ void Lz_rom::Main::handle_session_request(Xml_node request)
}
error("failed to decompress '", lz_path, "', ", msg);
} catch (...) { }
env.parent().session_response(server_id, Parent::INVALID_ARGS);
env.parent().session_response(server_id, Parent::SERVICE_DENIED);
}
if (request.has_type("close")) {

View File

@@ -167,35 +167,32 @@ void Rom_fallback::Main::handle_session_request(Xml_node request)
return;
}
catch (Parent::Service_denied) {
catch (Service_denied) {
warning("'", new_label, "' was denied"); }
catch (Service::Unavailable) {
warning("'", new_label, "' is unavailable"); }
catch (Insufficient_ram_quota) {
warning("'", new_label, "' RAM quota donation was insufficient"); }
catch (Service::Invalid_args) {
warning("'", new_label, "' received invalid args"); }
catch (Service::Quota_exceeded) {
warning("'", new_label, "' quota donation was insufficient"); }
catch (Insufficient_cap_quota) {
warning("'", new_label, "' cap quota donation was insufficient"); }
if (session)
destroy(heap, session);
}
error("no service found for ROM '", original.string(), "'");
env.parent().session_response(server_id, Parent::INVALID_ARGS);
env.parent().session_response(server_id, Parent::SERVICE_DENIED);
}
if (request.has_type("upgrade")) {
server_id_space.apply<Session>(server_id, [&] (Session &session) {
size_t ram_quota = request.attribute_value("ram_quota", 0UL);
Ram_quota ram_quota { request.attribute_value("ram_quota", 0UL) };
Cap_quota cap_quota { request.attribute_value("cap_quota", 0UL) };
String<64> args("ram_quota=", ram_quota);
String<80> args("ram_quota=", ram_quota, ", cap_quota=", cap_quota);
// XXX handle Root::Invalid_args
env.upgrade(session.client_id.id(), args.string());
env.parent().session_response(server_id, Parent::SESSION_OK);
});
@@ -217,4 +214,4 @@ void Component::construct(Genode::Env &env)
static Rom_fallback::Main inst(env);
env.parent().announce("ROM");
}
}

View File

@@ -142,7 +142,7 @@ class Tftp_rom::Session_component :
{
if (_pcb == NULL) {
Genode::error("failed to create UDP context");
throw Genode::Root::Unavailable();
throw Genode::Service_denied();
}
/* set callback */
@@ -477,7 +477,7 @@ class Tftp_rom::Root : public Genode::Root_component<Session_component>
ipaddr_aton(addr_str, &ipaddr);
} catch (...) {
Genode::error(label.string(), ": 'ip' not specified in policy");
throw Root::Unavailable();
throw Service_denied();
}
try { policy.attribute("port").value(&port); }
@@ -503,10 +503,10 @@ class Tftp_rom::Root : public Genode::Root_component<Session_component>
_timeout_dispatcher.elapsed_ms(), timeout*1000);
Genode::log(label.string(), " requested");
}
} catch (Session_policy::No_policy_defined) {
}
catch (Session_policy::No_policy_defined) {
Genode::error("no policy for defined for ", label.string());
throw Root::Unavailable();
throw Service_denied();
}
_timeout_dispatcher.insert(session);
@@ -531,7 +531,7 @@ class Tftp_rom::Root : public Genode::Root_component<Session_component>
};
void Libc::Component::construct(Genode::Env &env )
void Libc::Component::construct(Libc::Env &env )
{
static Genode::Sliced_heap sliced_heap(env.ram(), env.rm());
static Tftp_rom::Root root(env, sliced_heap);