]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/cxx/lib/ipc/include/ipc_helper
update
[l4.git] / l4 / pkg / cxx / lib / ipc / include / ipc_helper
1 // vi:ft=cpp
2 /**
3  * \file
4  * \brief IPC helper
5  */
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  *               Alexander Warg <warg@os.inf.tu-dresden.de>
9  *     economic rights: Technische Universität Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction.  Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License.  This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24
25 #pragma once
26
27 #include <l4/cxx/exceptions>
28 #include <l4/sys/utcb.h>
29
30 namespace L4
31 {
32
33
34 #ifdef __EXCEPTIONS
35   /**
36    * \brief Throw an L4 IPC error as exception.
37    *
38    * \ingroup helper
39    * \param o the client side object, for which the IPC was invoked.
40    * \param err the IPC result code (error code).
41    */
42   inline void
43   throw_ipc_exception(L4::Cap<void> const &o, l4_msgtag_t const &err,
44                       l4_utcb_t *utcb)
45   {
46     (void)o;
47     if (err.has_error())
48       throw (L4::Com_error(l4_error_u(err, utcb)));
49   }
50
51   /**
52    * \brief Throw an L4 IPC error as exception.
53    *
54    * \ingroup helper
55    * \param o the client side object, for which the IPC was invoked.
56    * \param err the IPC result code (error code).
57    */
58   inline void
59   throw_ipc_exception(void const *o, l4_msgtag_t const &err,
60                       l4_utcb_t *utcb)
61   { throw_ipc_exception(L4::Cap<void>(o), err, utcb); }
62 #endif
63
64 };