diff --git a/repos/base-fiasco/src/lib/base/ipc.cc b/repos/base-fiasco/src/lib/base/ipc.cc index ada92f9397..613c8d9875 100644 --- a/repos/base-fiasco/src/lib/base/ipc.cc +++ b/repos/base-fiasco/src/lib/base/ipc.cc @@ -14,7 +14,6 @@ /* Genode includes */ #include #include -#include /* base-internal includes */ #include @@ -166,10 +165,6 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, rcv_header.extract_caps(rcv_msg); if (L4_IPC_IS_ERROR(ipc_result)) { - - if (L4_IPC_ERROR(ipc_result) == L4_IPC_RECANCELED) - throw Genode::Blocking_canceled(); - error("ipc_call error ", Hex(L4_IPC_ERROR(ipc_result))); throw Genode::Ipc_error(); } diff --git a/repos/base-foc/src/lib/base/ipc.cc b/repos/base-foc/src/lib/base/ipc.cc index c674f4535f..1b6985d9c6 100644 --- a/repos/base-foc/src/lib/base/ipc.cc +++ b/repos/base-foc/src/lib/base/ipc.cc @@ -21,10 +21,10 @@ */ /* Genode includes */ -#include #include #include #include +#include /* base-internal includes */ #include /* for 'thread_get_my_native_id()' */ @@ -279,11 +279,10 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, l4_msgtag_t const reply_tag = l4_ipc_call(dst.data()->kcap(), l4_utcb(), call_tag, L4_IPC_NEVER); - if (l4_ipc_error(reply_tag, l4_utcb()) == L4_IPC_RECANCELED) - throw Genode::Blocking_canceled(); - - if (ipc_error(reply_tag, DEBUG_MSG)) - throw Genode::Ipc_error(); + if (ipc_error(reply_tag, DEBUG_MSG)) { + raw("L4 IPC error"); + sleep_forever(); + } return Rpc_exception_code(extract_msg_from_utcb(reply_tag, rcv_window, rcv_msg)); } diff --git a/repos/base-hw/src/lib/base/ipc.cc b/repos/base-hw/src/lib/base/ipc.cc index 4990f6eccc..0bd382cb04 100644 --- a/repos/base-hw/src/lib/base/ipc.cc +++ b/repos/base-hw/src/lib/base/ipc.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -106,7 +107,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, switch (Kernel::send_request_msg(Capability_space::capid(dst), (unsigned)rcv_caps)) { - case -1: throw Blocking_canceled(); + case -1: sleep_forever(); case -2: upgrade_capability_slab(); break; default: done = true; break; } @@ -152,7 +153,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &, } switch (ret) { - case -1: throw Blocking_canceled(); + case -1: sleep_forever(); case -2: upgrade_capability_slab(); break; default: done = true; break; } diff --git a/repos/base-linux/src/lib/base/ipc.cc b/repos/base-linux/src/lib/base/ipc.cc index 543b0db58a..6365642dd9 100644 --- a/repos/base-linux/src/lib/base/ipc.cc +++ b/repos/base-linux/src/lib/base/ipc.cc @@ -17,7 +17,6 @@ /* Genode includes */ #include #include -#include #include #include #include @@ -326,7 +325,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, int const send_ret = lx_sendmsg(dst_socket, snd_msg.msg(), 0); if (send_ret < 0) { error(lx_getpid(), ":", lx_gettid(), " lx_sendmsg to sd ", dst_socket, - " failed with ", send_ret, " in lx_call()"); + " failed with ", send_ret, " in lx_call()"); sleep_forever(); } @@ -339,14 +338,19 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, rcv_msg.accept_sockets(Message::MAX_SDS_PER_MSG); rcv_msgbuf.reset(); - int const recv_ret = lx_recvmsg(reply_channel.local, rcv_msg.msg(), 0); - /* system call got interrupted by a signal */ - if (recv_ret == -LX_EINTR) - throw Genode::Blocking_canceled(); + for (;;) { + int const recv_ret = lx_recvmsg(reply_channel.local, rcv_msg.msg(), 0); - if (recv_ret < 0) { - error(lx_getpid(), ":", lx_gettid(), " ipc_call failed to receive result (", recv_ret, ")"); + /* system call got interrupted by a signal */ + if (recv_ret == -LX_EINTR) + continue; + + if (recv_ret >= 0) + break; + + error(lx_getpid(), ":", lx_gettid(), + " ipc_call failed to receive result (", recv_ret, ")"); sleep_forever(); } diff --git a/repos/base-linux/src/timer/linux/time_source.cc b/repos/base-linux/src/timer/linux/time_source.cc index 7aa076ac17..80979e981a 100644 --- a/repos/base-linux/src/timer/linux/time_source.cc +++ b/repos/base-linux/src/timer/linux/time_source.cc @@ -47,6 +47,5 @@ void Timer::Time_source::_usleep(uint64_t us) ts.tv_sec = (long)us / (1000 * 1000); ts.tv_nsec = ((long)us % (1000 * 1000)) * 1000; - if (lx_nanosleep(&ts, &ts) != 0) - throw Blocking_canceled(); + lx_nanosleep(&ts, &ts); } diff --git a/repos/base-nova/src/lib/base/rpc_entrypoint.cc b/repos/base-nova/src/lib/base/rpc_entrypoint.cc index 408798f3ee..727d64469e 100644 --- a/repos/base-nova/src/lib/base/rpc_entrypoint.cc +++ b/repos/base-nova/src/lib/base/rpc_entrypoint.cc @@ -157,7 +157,8 @@ void Rpc_entrypoint::_activation_entry() } /* atomically lookup and lock referenced object */ - auto lambda = [&] (Rpc_object_base *obj) { + auto lambda = [&] (Rpc_object_base *obj) + { if (!obj) { error("could not look up server object, return from call id_pt=", id_pt); return; @@ -165,8 +166,7 @@ void Rpc_entrypoint::_activation_entry() /* dispatch request */ ep._snd_buf.reset(); - try { exc = obj->dispatch(opcode, unmarshaller, ep._snd_buf); } - catch (Blocking_canceled) { } + exc = obj->dispatch(opcode, unmarshaller, ep._snd_buf); }; ep.apply(id_pt, lambda); diff --git a/repos/base-okl4/src/lib/base/ipc.cc b/repos/base-okl4/src/lib/base/ipc.cc index f2f6b0ef08..7402df1e6d 100644 --- a/repos/base-okl4/src/lib/base/ipc.cc +++ b/repos/base-okl4/src/lib/base/ipc.cc @@ -14,7 +14,7 @@ /* Genode includes */ #include #include -#include +#include /* base-internal includes */ #include @@ -162,15 +162,9 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst, L4_MsgTag_t rcv_tag = L4_Call(dst_data.dst); - enum { ERROR_MASK = 0xe, ERROR_CANCELED = 3 << 1 }; - if (L4_IpcFailed(rcv_tag) && - ((L4_ErrorCode() & ERROR_MASK) == ERROR_CANCELED)) - throw Genode::Blocking_canceled(); - if (L4_IpcFailed(rcv_tag)) { raw("Ipc failed"); - - return Rpc_exception_code(Rpc_exception_code::INVALID_OBJECT); + sleep_forever(); } return Rpc_exception_code(extract_msg_from_utcb(rcv_tag, rcv_msg)); diff --git a/repos/base-pistachio/src/lib/base/ipc.cc b/repos/base-pistachio/src/lib/base/ipc.cc index ac04cbea76..66d14d9fa0 100644 --- a/repos/base-pistachio/src/lib/base/ipc.cc +++ b/repos/base-pistachio/src/lib/base/ipc.cc @@ -15,7 +15,6 @@ /* Genode includes */ #include #include -#include #include /* base-internal includes */ @@ -32,26 +31,18 @@ using namespace Pistachio; */ static inline void check_ipc_result(L4_MsgTag_t result, L4_Word_t error_code) { - /* - * Test for IPC cancellation via Core's cancel-blocking mechanism - */ - enum { ERROR_MASK = 0xe, ERROR_CANCELED = 3 << 1 }; - if (L4_IpcFailed(result) && - ((L4_ErrorCode() & ERROR_MASK) == ERROR_CANCELED)) - throw Genode::Blocking_canceled(); - /* * Provide diagnostic information on unexpected conditions */ if (L4_IpcFailed(result)) { raw("Error in thread ", Hex(L4_Myself().raw), ". IPC failed."); - throw Genode::Ipc_error(); + throw Ipc_error(); } if (L4_UntypedWords(result) < 2) { raw("Error in thread ", Hex(L4_Myself().raw), ". " "Expected at leat two untyped words, but got ", L4_UntypedWords(result), ".\n"); - throw Genode::Ipc_error(); + throw Ipc_error(); } } diff --git a/repos/base-sel4/src/lib/base/ipc.cc b/repos/base-sel4/src/lib/base/ipc.cc index fe1a4b1580..f4c79cf5a1 100644 --- a/repos/base-sel4/src/lib/base/ipc.cc +++ b/repos/base-sel4/src/lib/base/ipc.cc @@ -12,7 +12,6 @@ */ /* Genode includes */ -#include #include #include #include diff --git a/repos/base/include/base/blocking.h b/repos/base/include/base/blocking.h deleted file mode 100644 index 6c2c6335b2..0000000000 --- a/repos/base/include/base/blocking.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * \brief Support for blocking operations - * \author Norman Feske - * \date 2007-09-06 - */ - -/* - * Copyright (C) 2007-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__BLOCKING_H_ -#define _INCLUDE__BASE__BLOCKING_H_ - -#include - -namespace Genode { class Blocking_canceled; } - -/** - * Blocking-canceled exception - * - * Two operations may block a thread, waiting at a lock or performing an RPC - * call. Both operations may be canceled when the thread is destructed. In this - * case, the thread unblocks and throws an exception, and therefore, is able to - * clean up the thread state before exiting. - */ -class Genode::Blocking_canceled : public Exception { }; - -#endif /* _INCLUDE__BASE__BLOCKING_H_ */ diff --git a/repos/base/include/base/ipc.h b/repos/base/include/base/ipc.h index 6838d2f703..84920fd36b 100644 --- a/repos/base/include/base/ipc.h +++ b/repos/base/include/base/ipc.h @@ -30,7 +30,6 @@ namespace Genode { * Invoke capability to call an RPC function * * \param rcv_caps number of capabilities expected as result - * \throw Blocking_canceled * * \noapi * diff --git a/repos/base/include/base/lock.h b/repos/base/include/base/lock.h index dedc334669..003ab0dce6 100644 --- a/repos/base/include/base/lock.h +++ b/repos/base/include/base/lock.h @@ -15,7 +15,6 @@ #define _INCLUDE__BASE__LOCK_H_ #include -#include namespace Genode { class Lock; diff --git a/repos/base/src/lib/base/entrypoint.cc b/repos/base/src/lib/base/entrypoint.cc index 827f304009..879a89fb93 100644 --- a/repos/base/src/lib/base/entrypoint.cc +++ b/repos/base/src/lib/base/entrypoint.cc @@ -134,9 +134,7 @@ void Entrypoint::_process_incoming_signals() * as result, which has to be caught. */ try { - retry( - [&] () { _signal_proxy_cap.call(); }, - [] () { warning("blocking canceled during signal processing"); }); + _signal_proxy_cap.call(); } catch (Genode::Ipc_error) { /* ignore - context got destroyed in meantime */ } /* entrypoint destructor requested to stop signal handling */ @@ -345,11 +343,7 @@ Entrypoint::Entrypoint(Env &env) _env.ep().manage(constructor); - try { - invoke_constructor_at_entrypoint(constructor.cap()); - } catch (Blocking_canceled) { - warning("blocking canceled in entrypoint constructor"); - } + invoke_constructor_at_entrypoint(constructor.cap()); _env.ep().dissolve(constructor); diff --git a/repos/base/src/lib/base/rpc_dispatch_loop.cc b/repos/base/src/lib/base/rpc_dispatch_loop.cc index 5fc801983d..50f21b37a2 100644 --- a/repos/base/src/lib/base/rpc_dispatch_loop.cc +++ b/repos/base/src/lib/base/rpc_dispatch_loop.cc @@ -67,9 +67,8 @@ void Rpc_entrypoint::entry() apply(request.badge, [&] (Rpc_object_base *obj) { - if (!obj) { return;} - try { exc = obj->dispatch(opcode, unmarshaller, _snd_buf); } - catch(Blocking_canceled&) { } + if (obj) + exc = obj->dispatch(opcode, unmarshaller, _snd_buf); }); } diff --git a/repos/base/src/lib/base/rpc_entrypoint.cc b/repos/base/src/lib/base/rpc_entrypoint.cc index 8ad8cceedb..57c6ae4758 100644 --- a/repos/base/src/lib/base/rpc_entrypoint.cc +++ b/repos/base/src/lib/base/rpc_entrypoint.cc @@ -14,7 +14,6 @@ /* Genode includes */ #include #include -#include #include /* base-internal includes */ diff --git a/repos/base/src/timer/periodic/time_source.cc b/repos/base/src/timer/periodic/time_source.cc index 46deb0ed45..327fffd774 100644 --- a/repos/base/src/timer/periodic/time_source.cc +++ b/repos/base/src/timer/periodic/time_source.cc @@ -36,8 +36,7 @@ Timer::Time_source::_wait_for_irq() while (_next_timeout_us > 0) { _mutex.release(); - try { _usleep(SLEEP_GRANULARITY_US); } - catch (Blocking_canceled) { } + _usleep(SLEEP_GRANULARITY_US); uint64_t curr_time_us = curr_time().trunc_to_plain_us().value; uint64_t sleep_duration_us = curr_time_us - last_time_us;