1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *               Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  *
10  * As a special exception, you may use this file as part of a free software
11  * library without restriction.  Specifically, if other files instantiate
12  * templates or use macros or inline functions from this file, or you compile
13  * this file and link it with other files to produce an executable, this
14  * file does not by itself cause the resulting executable to be covered by
15  * the GNU General Public License.  This exception does not however
16  * invalidate any other reasons why the executable file might be covered by
17  * the GNU General Public License.
18  */
19 #include <l4/re/c/util/cap_alloc.h>
20 #include <l4/re/util/cap_alloc>
21 
l4re_util_cap_alloc(void)22 l4_cap_idx_t l4re_util_cap_alloc(void) L4_NOTHROW
23 {
24   return L4Re::Util::cap_alloc.alloc<void>().cap();
25 }
26 
l4re_util_cap_free(l4_cap_idx_t cap)27 void l4re_util_cap_free(l4_cap_idx_t cap) L4_NOTHROW
28 {
29   L4Re::Util::cap_alloc.free(L4::Cap<void>(cap));
30 }
31 
l4re_util_cap_free_um(l4_cap_idx_t cap)32 void l4re_util_cap_free_um(l4_cap_idx_t cap) L4_NOTHROW
33 {
34   L4Re::Util::cap_alloc.free(L4::Cap<void>(cap), L4Re::This_task);
35 }
36 
37 long
l4re_util_cap_last(void)38 l4re_util_cap_last(void) L4_NOTHROW
39 {
40   return L4Re::Util::cap_alloc.last();
41 }
42