genode/repos/dde_rump/include/rump/env.h
Josef Söntgen 1d6d6966a1 rump: add knob to set memlimit
By now, rump would query its available RAM quota to determine the
memory limit minus some RAM reserved for Genode meta-data. This
does not work when the VFS rump plugin is used as the available
quota belongs to the VFS server. In this case the memlimit should
be set by specifing the RAM in the plugin's config, e.g.:

! <vfs>
!   <rump fs="ext2fs" ram="64M" writeabl="yes"/>
! </vfs>

Fixes #2783.
2018-05-03 15:31:23 +02:00

55 lines
1.2 KiB
C++

/*
* \brief Helper class to make the Genode Env globally available
* \author Sebastian Sumpf
* \date 2016-06-21
*/
/*
* Copyright (C) 2016-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__RUMP__ENV_H_
#define _INCLUDE__RUMP__ENV_H_
#include <base/attached_rom_dataspace.h>
#include <base/env.h>
#include <base/heap.h>
#include <util/reconstructible.h>
namespace Rump {
class Env;
Env &env();
void construct_env(Genode::Env &env);
}
class Rump::Env
{
private:
Genode::Env &_env;
Genode::Heap _heap { _env.ram(), _env.rm() };
Genode::Attached_rom_dataspace _config { _env, "config" };
public:
Env(Genode::Env &env) : _env(env) { }
Genode::Env &env() { return _env; }
Genode::Heap &heap() { return _heap; }
Genode::Attached_rom_dataspace &config_rom() { return _config; }
};
/**
* Set rump MEMLIMIT
*
* In case limit is zero, the available RAM quota will be used.
*/
void rump_set_memlimit(Genode::size_t limit);
#endif /* _INCLUDE__RUMP__ENV_H_ */