genode/repos/os/include/os/static_root.h
Norman Feske 6d361b337b input/root.h: support re-opening of sessions
This patch fixes an aliasing problem of the 'close' method signature
that prevented the Input::Root_component::close method to be called.
This way, the event-queue state was not reset at session-close time,
which prevented a subsequent session-creation request to succeed. With
the patch, input servers like ps2_drv, usb_drv that rely on the
Input::Root_component support the dynamic re-opening of sessions. This
happens in particular when using a dynamically configured input filter.
2017-10-05 17:40:03 +02:00

65 lines
1.5 KiB
C++

/*
* \brief Root component for singleton services
* \author Norman Feske
* \date 2012-10-05
*/
/*
* Copyright (C) 2012-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__OS__STATIC_ROOT_H_
#define _INCLUDE__OS__STATIC_ROOT_H_
/* Genode includes */
#include <base/rpc_server.h>
#include <session/session.h>
#include <root/root.h>
namespace Genode { template <typename> class Static_root; }
/**
* Root interface that hands out a statically created session
*
* Many components, in particular device drivers, support only one client
* at a time. In this case, one single session may be created right at the
* start of the program and handed out via the 'Root::session' method.
*/
template <typename SESSION>
class Genode::Static_root : public Genode::Rpc_object<Genode::Typed_root<SESSION> >
{
private:
Capability<SESSION> _session;
public:
/**
* Constructor
*
* \param session session to be provided to the client
*/
Static_root(Capability<SESSION> session) : _session(session) { }
/********************
** Root interface **
********************/
Capability<Session> session(Root::Session_args const &args, Affinity const &) override
{
return _session;
}
void upgrade(Capability<Session>, Root::Upgrade_args const &) override { }
void close(Capability<Session>) override { }
};
#endif /* _INCLUDE__OS__STATIC_ROOT_H_ */