2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Noux-session client interface
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2011-02-15
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2011-2013 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__NOUX_SESSION__CLIENT_H_
|
|
|
|
#define _INCLUDE__NOUX_SESSION__CLIENT_H_
|
|
|
|
|
|
|
|
#include <noux_session/noux_session.h>
|
|
|
|
#include <noux_session/capability.h>
|
|
|
|
#include <base/rpc_client.h>
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
#include <base/log.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
namespace Noux {
|
|
|
|
|
2012-04-23 18:42:55 +00:00
|
|
|
struct Session_client : Rpc_client<Session>
|
2011-12-22 15:19:25 +00:00
|
|
|
{
|
|
|
|
explicit Session_client(Session_capability session)
|
2012-04-23 18:42:55 +00:00
|
|
|
: Rpc_client<Session>(session) { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
|
2012-04-23 18:42:55 +00:00
|
|
|
Dataspace_capability sysio_dataspace()
|
2011-12-22 15:19:25 +00:00
|
|
|
{
|
|
|
|
return call<Rpc_sysio_dataspace>();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool syscall(Syscall sc)
|
|
|
|
{
|
2012-10-08 12:44:31 +00:00
|
|
|
static bool verbose = false;
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
bool result = call<Rpc_syscall>(sc);
|
|
|
|
|
2012-10-08 12:44:31 +00:00
|
|
|
if ((result == false) && verbose)
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
error("syscall ", syscall_name(sc), " failed");
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2013-09-06 19:10:23 +00:00
|
|
|
|
|
|
|
int next_open_fd(int start_fd)
|
|
|
|
{
|
|
|
|
return call<Rpc_next_open_fd>(start_fd);
|
|
|
|
}
|
2014-01-28 13:07:36 +00:00
|
|
|
|
2016-04-15 13:19:22 +00:00
|
|
|
Capability<Region_map> lookup_region_map(addr_t const addr)
|
2014-01-28 13:07:36 +00:00
|
|
|
{
|
2016-04-15 13:19:22 +00:00
|
|
|
return call<Rpc_lookup_region_map>(addr);
|
2014-01-28 13:07:36 +00:00
|
|
|
}
|
2011-12-22 15:19:25 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__NOUX_SESSION__CLIENT_H_ */
|