file_terminal: remove env deprecated warnings

Issue #2280.
This commit is contained in:
Josef Söntgen 2017-02-23 15:08:46 +01:00 committed by Christian Helmuth
parent 567ec255f1
commit 06f5ee21c0
2 changed files with 29 additions and 29 deletions

View File

@ -12,11 +12,9 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <libc/component.h>
#include <base/heap.h> #include <base/heap.h>
#include <base/log.h> #include <base/log.h>
#include <base/rpc_server.h>
#include <base/sleep.h>
#include <cap_session/connection.h>
#include <base/attached_ram_dataspace.h> #include <base/attached_ram_dataspace.h>
#include <os/session_policy.h> #include <os/session_policy.h>
#include <root/component.h> #include <root/component.h>
@ -157,10 +155,11 @@ namespace Terminal {
public: public:
Session_component(Genode::size_t io_buffer_size, const char *filename) Session_component(Genode::Env &env,
Genode::size_t io_buffer_size, const char *filename)
: :
Open_file(filename), Open_file(filename),
_io_buffer(Genode::env()->ram_session(), io_buffer_size) _io_buffer(env.ram(), env.rm(), io_buffer_size)
{ } { }
/******************************** /********************************
@ -223,6 +222,10 @@ namespace Terminal {
class Root_component : public Genode::Root_component<Session_component> class Root_component : public Genode::Root_component<Session_component>
{ {
private:
Genode::Env &_env;
protected: protected:
Session_component *_create_session(const char *args) Session_component *_create_session(const char *args)
@ -240,7 +243,7 @@ namespace Terminal {
policy.attribute("io_buffer_size").value(&io_buffer_size); policy.attribute("io_buffer_size").value(&io_buffer_size);
return new (md_alloc()) return new (md_alloc())
Session_component(io_buffer_size, filename); Session_component(_env, io_buffer_size, filename);
} catch (Genode::Xml_node::Nonexistent_attribute) { } catch (Genode::Xml_node::Nonexistent_attribute) {
Genode::error("missing \"filename\" attribute in policy definition"); Genode::error("missing \"filename\" attribute in policy definition");
@ -256,38 +259,35 @@ namespace Terminal {
/** /**
* Constructor * Constructor
*/ */
Root_component(Genode::Rpc_entrypoint *ep, Root_component(Genode::Env &env,
Genode::Allocator *md_alloc) Genode::Allocator *md_alloc)
: :
Genode::Root_component<Session_component>(ep, md_alloc) Genode::Root_component<Session_component>(&env.ep().rpc_ep(), md_alloc),
_env(env)
{ } { }
}; };
} }
int main() struct Main
{ {
using namespace Genode; Genode::Env &_env;
Genode::log("--- file terminal started ---"); Genode::Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
/**
* The stack needs to be that large because certain functions
* in the libc (e.g. mktime(3)) require a huge stack.
*/
enum { STACK_SIZE = 16*sizeof(addr_t)*1024 };
static Cap_connection cap;
static Rpc_entrypoint ep(&cap, STACK_SIZE, "terminal_ep");
static Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session());
/* create root interface for service */ /* create root interface for service */
static Terminal::Root_component root(&ep, &sliced_heap); Terminal::Root_component _root { _env, &_sliced_heap };
/* announce service at our parent */ Main(Genode::Env &env) : _env(env)
env()->parent()->announce(ep.manage(&root)); {
using namespace Genode;
Genode::sleep_forever(); Genode::log("--- file terminal started ---");
return 0; /* announce service at our parent */
} _env.parent().announce(env.ep().manage(_root));
}
};
void Libc::Component::construct(Libc::Env &env) { static Main main(env); }

View File

@ -1,3 +1,3 @@
TARGET = file_terminal TARGET = file_terminal
SRC_CC = main.cc SRC_CC = main.cc
LIBS = posix LIBS = libc