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)
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.
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.
20 #include <l4/sys/err.h>
21 #include <l4/sys/ipc.h>
23 char const *l4sys_errtostr(long err);
25 static char const *const _l4sys_errortab[L4_ERRNOMAX] = {
27 [L4_EPERM] = "Operation not permitted",
28 [L4_ENOENT] = "No such object found",
29 [L4_EIO] = "I/O error",
30 [L4_EAGAIN] = "Try again",
31 [L4_ENOMEM] = "Insufficient memory",
32 [L4_EACCESS] = "Access not permitted",
33 [L4_EEXIST] = "Object exists",
34 [L4_ENODEV] = "No such device",
35 [L4_EINVAL] = "Invalid argument",
36 [L4_ERANGE] = "Argument out of range",
37 [L4_ENAMETOOLONG] = "Name too long",
38 [L4_ENOSYS] = "Invalid request",
39 [L4_EBADPROTO] = "Invalid protocol",
40 [L4_EADDRNOTAVAIL] = "Address not available"
43 static char const *const _l4sys_ipc_errortab[L4_EIPC_HI - L4_EIPC_LO] = {
45 [L4_IPC_SETIMEOUT] = "Send timeout",
46 [L4_IPC_RETIMEOUT] = "Receive timeout",
47 [L4_IPC_ENOT_EXISTENT] = "Void capability invoked",
48 [L4_IPC_SECANCELED] = "Send operation canceled",
49 [L4_IPC_RECANCELED] = "Receive operation canceled",
50 [L4_IPC_SEMSGCUT] = "Overflow during send operation",
51 [L4_IPC_REMSGCUT] = "Overflow during receive operation",
52 [L4_IPC_SESNDPFTO] = "Send page-fault timeout (send phase)",
53 [L4_IPC_RESNDPFTO] = "Send page-fault timeout (receive phase)",
54 [L4_IPC_SERCVPFTO] = "Receive page-fault timeout (send phase)",
55 [L4_IPC_RERCVPFTO] = "Receive page-fault timeout (receive phase)",
56 [L4_IPC_SEABORTED] = "Send operation aborted",
57 [L4_IPC_REABORTED] = "Receive operation aborted",
58 [L4_IPC_SEMAPFAILED] = "Map operation failed (send phase)",
59 [L4_IPC_REMAPFAILED] = "Map operation failed (receive phase)"
62 char const *l4sys_errtostr(long err)
65 if (err >= 0 && err < L4_ERRNOMAX)
66 return _l4sys_errortab[err];
67 else if (err >= L4_EIPC_LO && err < L4_EIPC_HI)
68 return _l4sys_ipc_errortab[err-L4_EIPC_LO];
70 return "bad, unknown runtime error";