2015-03-17 11:49:21 +01:00
|
|
|
/*
|
|
|
|
* \brief NOVA specific implementation of the signaling framework
|
|
|
|
* \author Alexander Boettcher
|
|
|
|
* \date 2015-03-16
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2015-2017 Genode Labs GmbH
|
2015-03-17 11:49:21 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2015-03-17 11:49:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2016-01-14 13:22:00 +01:00
|
|
|
#include <base/signal.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 19:07:09 +02:00
|
|
|
#include <base/log.h>
|
2016-01-14 13:22:00 +01:00
|
|
|
#include <base/trace/events.h>
|
2015-03-17 11:49:21 +01:00
|
|
|
|
2017-05-10 20:11:38 +02:00
|
|
|
/* base-internal includes */
|
|
|
|
#include <base/internal/globals.h>
|
|
|
|
|
2016-06-15 15:04:54 +02:00
|
|
|
/* NOVA includes */
|
|
|
|
#include <nova/syscalls.h>
|
|
|
|
|
2015-03-17 11:49:21 +01:00
|
|
|
using namespace Genode;
|
|
|
|
|
2016-01-14 13:22:00 +01:00
|
|
|
|
2017-05-10 20:11:38 +02:00
|
|
|
void Genode::init_signal_transmitter(Env &) { }
|
|
|
|
|
|
|
|
|
2015-03-17 11:49:21 +01:00
|
|
|
void Signal_transmitter::submit(unsigned cnt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Trace::Signal_submit trace_event(cnt);
|
|
|
|
}
|
|
|
|
|
2015-09-07 13:34:42 +02:00
|
|
|
if (!_context.valid())
|
|
|
|
return;
|
|
|
|
|
2015-03-17 11:49:21 +01:00
|
|
|
using namespace Nova;
|
|
|
|
|
|
|
|
uint8_t res = NOVA_OK;
|
|
|
|
for (unsigned i = 0; res == NOVA_OK && i < cnt; i++)
|
|
|
|
res = sm_ctrl(_context.local_name(), SEMAPHORE_UP);
|
|
|
|
|
2016-02-01 20:50:17 +01:00
|
|
|
if (res == NOVA_OK)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_context = Signal_context_capability();
|
2015-03-17 11:49:21 +01:00
|
|
|
}
|