genode/ports/src/noux/environment.h

50 lines
1006 B
C
Raw Normal View History

2011-12-22 16:19:25 +01:00
/*
* \brief Process environment utility
* \author Norman Feske
* \date 2011-02-17
*/
/*
2013-01-10 21:44:47 +01:00
* Copyright (C) 2011-2013 Genode Labs GmbH
2011-12-22 16:19:25 +01:00
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <util/string.h>
#include <os/attached_ram_dataspace.h>
#include <base/printf.h>
/* Noux includes */
#include <path.h>
namespace Noux {
class Environment : private Attached_ram_dataspace
2011-12-22 16:19:25 +01:00
{
private:
Sysio::Env *_env;
2011-12-22 16:19:25 +01:00
public:
/**
* \param env comma-separated list of environment variables
*/
Environment(Sysio::Env const &env) :
Attached_ram_dataspace(Genode::env()->ram_session(), sizeof(Sysio::Env)),
_env(local_addr<Sysio::Env>())
2011-12-22 16:19:25 +01:00
{
memcpy(_env, env, sizeof(Sysio::Env));
2011-12-22 16:19:25 +01:00
}
using Attached_ram_dataspace::cap;
2011-12-22 16:19:25 +01:00
/**
* Return list of environment variables as zero-separated list
*/
Sysio::Env const &env() { return *_env; }
2011-12-22 16:19:25 +01:00
};
}