]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/error.c
Remove annoying warnings and fix tty for restart
[mirror_lxc.git] / src / lxc / error.c
1 /*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include "error.h"
27
28 static const char *const catalogue[] = {
29
30 [LXC_ERROR_LOCK] = "Failed to lock the container",
31
32 [LXC_ERROR_EMPTY] = "The container is empty",
33 [LXC_ERROR_ALREADY_EXISTS] = "The container already exists",
34 [LXC_ERROR_BUSY] = "The container is busy",
35 [LXC_ERROR_NOT_FOUND] = "The container was not found",
36 [LXC_ERROR_PERMISSION_DENIED] = "Permission denied",
37 [LXC_ERROR_WRONG_COMMAND] = "Wrong command",
38
39 [LXC_ERROR_CONF_CGROUP] = "Failed to configure the control group",
40 [LXC_ERROR_CONF_MOUNT] = "Failed to configure the mount points",
41 [LXC_ERROR_CONF_UTSNAME] = "Failed to configure the utsname",
42 [LXC_ERROR_CONF_NETWORK] = "Failed to configure the network",
43 [LXC_ERROR_CONF_ROOTFS] = "Failed to configure the root fs",
44
45 [LXC_ERROR_SETUP_CGROUP] = "Failed to setup the control group",
46 [LXC_ERROR_SETUP_MOUNT] = "Failed to setup the mount points",
47 [LXC_ERROR_SETUP_UTSNAME] = "Failed to setup the utsname",
48 [LXC_ERROR_SETUP_NETWORK] = "Failed to setup the network",
49 [LXC_ERROR_SETUP_CONSOLE] = "Failed to setup the console",
50 [LXC_ERROR_SETUP_ROOTFS] = "Failed to setup the root fs",
51
52 [LXC_ERROR_INTERNAL] = "Internal system error",
53 };
54
55 const char *const lxc_strerror(int error)
56 {
57 error = abs(error);
58
59 if (error >= LXC_LAST_ERROR)
60 return NULL;
61
62 return catalogue[error];
63 }