This patch adjusts the implementation of the base library and core such that the code no longer relies on deprecated APIs except for very few cases, mainly to keep those deprecated APIs in tact for now. The most prominent changes are: - Removing the use of base/printf.h - Removing of the log backend for printf. The 'Console' with the format-string parser is still there along with 'snprintf.h' because the latter is still used at a few places, most prominently the 'Connection' classes. - Removing the notion of a RAM session, which does not exist in Genode anymore. Still the types were preserved (by typedefs to PD session) to keep up compatibility. But this transition should come to an end now. - Slight rennovation of core's tracing service, e.g., the use of an Attached_dataspace as the Argument_buffer. - Reducing the reliance on global accessors like deprecated_env() or core_env(). Still there is a longish way to go to eliminate all such calls. A useful pattern (or at least a stop-gap solution) is to pass the 'Env' to the individual compilation units via init functions. - Avoiding the use of the old 'Child_policy::resolve_session_request' interface that returned a 'Service' instead of a 'Route'. Issue #1987
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
/*
|
|
* \brief CPU-session client that upgrades its session quota on demand
|
|
* \author Norman Feske
|
|
* \date 2006-07-28
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2006-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__BASE__INTERNAL__EXPANDING_CPU_SESSION_CLIENT_H_
|
|
#define _INCLUDE__BASE__INTERNAL__EXPANDING_CPU_SESSION_CLIENT_H_
|
|
|
|
/* Genode includes */
|
|
#include <util/retry.h>
|
|
#include <cpu_session/client.h>
|
|
|
|
/* base-internal includes */
|
|
#include <base/internal/upgradeable_client.h>
|
|
|
|
|
|
namespace Genode { struct Expanding_cpu_session_client; }
|
|
|
|
|
|
struct Genode::Expanding_cpu_session_client : Upgradeable_client<Genode::Cpu_session_client>
|
|
{
|
|
Expanding_cpu_session_client(Parent &parent, Genode::Cpu_session_capability cap, Parent::Client::Id id)
|
|
:
|
|
/*
|
|
* We need to upcast the capability because on some platforms (i.e.,
|
|
* NOVA), 'Cpu_session_client' refers to a platform-specific session
|
|
* interface ('Nova_cpu_session').
|
|
*/
|
|
Upgradeable_client<Genode::Cpu_session_client>
|
|
(parent, static_cap_cast<Genode::Cpu_session_client::Rpc_interface>(cap), id)
|
|
{ }
|
|
|
|
Thread_capability
|
|
create_thread(Pd_session_capability pd, Name const &name,
|
|
Affinity::Location location, Weight weight, addr_t utcb) override
|
|
{
|
|
return retry<Out_of_ram>(
|
|
[&] () {
|
|
return Cpu_session_client::create_thread(pd, name, location,
|
|
weight, utcb); },
|
|
[&] () { upgrade_ram(8*1024); });
|
|
}
|
|
};
|
|
|
|
#endif /* _INCLUDE__BASE__INTERNAL__EXPANDING_CPU_SESSION_CLIENT_H_ */
|