]>
Commit | Line | Data |
---|---|---|
58412580 | 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> | |
1f3da8f8 | 25 | #include <stdlib.h> |
58412580 | 26 | #include "error.h" |
27 | ||
1f3da8f8 | 28 | static const char *const catalogue[] = { |
58412580 | 29 | |
1f3da8f8 | 30 | [LXC_ERROR_LOCK] = "Failed to lock the container", |
31 | ||
b0a33c1e | 32 | [LXC_ERROR_ESRCH] = "The container is empty", |
33 | [LXC_ERROR_EEXIST] = "The container already exists", | |
34 | [LXC_ERROR_EBUSY] = "The container is busy", | |
35 | [LXC_ERROR_ENOENT] = "The container was not found", | |
36 | [LXC_ERROR_EACCES] = "Not enough privilege to use the container", | |
58412580 | 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", | |
b0a33c1e | 43 | [LXC_ERROR_CONF_TTY] = "Failed to configure the tty", |
58412580 | 44 | [LXC_ERROR_CONF_ROOTFS] = "Failed to configure the root fs", |
10db618d | 45 | [LXC_ERROR_CONF_PTS] = "Failed to configure the pts", |
58412580 | 46 | |
47 | [LXC_ERROR_SETUP_CGROUP] = "Failed to setup the control group", | |
48 | [LXC_ERROR_SETUP_MOUNT] = "Failed to setup the mount points", | |
49 | [LXC_ERROR_SETUP_UTSNAME] = "Failed to setup the utsname", | |
50 | [LXC_ERROR_SETUP_NETWORK] = "Failed to setup the network", | |
4c92bdfc | 51 | [LXC_ERROR_SETUP_CONSOLE] = "Failed to setup the console", |
b0a33c1e | 52 | [LXC_ERROR_SETUP_TTY] = "Failed to setup the tty", |
58412580 | 53 | [LXC_ERROR_SETUP_ROOTFS] = "Failed to setup the root fs", |
10db618d | 54 | [LXC_ERROR_SETUP_PTS] = "Failed to setup the new pts instance", |
e2bcd7db | 55 | |
b0a33c1e | 56 | [LXC_ERROR_TTY_DENIED] = "tty service denied", |
57 | [LXC_ERROR_TTY_EAGAIN] = "tty service is not available", | |
e2bcd7db | 58 | [LXC_ERROR_INTERNAL] = "Internal system error", |
58412580 | 59 | }; |
60 | ||
61 | const char *const lxc_strerror(int error) | |
62 | { | |
1f3da8f8 | 63 | error = abs(error); |
64 | ||
65 | if (error >= LXC_LAST_ERROR) | |
58412580 | 66 | return NULL; |
1f3da8f8 | 67 | |
58412580 | 68 | return catalogue[error]; |
69 | } |