]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/error.c
From: Daniel Lezcano <daniel.lezcano@free.fr>
[mirror_lxc.git] / src / lxc / error.c
CommitLineData
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 28static 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",
45
46 [LXC_ERROR_SETUP_CGROUP] = "Failed to setup the control group",
47 [LXC_ERROR_SETUP_MOUNT] = "Failed to setup the mount points",
48 [LXC_ERROR_SETUP_UTSNAME] = "Failed to setup the utsname",
49 [LXC_ERROR_SETUP_NETWORK] = "Failed to setup the network",
4c92bdfc 50 [LXC_ERROR_SETUP_CONSOLE] = "Failed to setup the console",
b0a33c1e 51 [LXC_ERROR_SETUP_TTY] = "Failed to setup the tty",
58412580 52 [LXC_ERROR_SETUP_ROOTFS] = "Failed to setup the root fs",
e2bcd7db 53
b0a33c1e 54 [LXC_ERROR_TTY_DENIED] = "tty service denied",
55 [LXC_ERROR_TTY_EAGAIN] = "tty service is not available",
e2bcd7db 56 [LXC_ERROR_INTERNAL] = "Internal system error",
58412580 57};
58
59const char *const lxc_strerror(int error)
60{
1f3da8f8 61 error = abs(error);
62
63 if (error >= LXC_LAST_ERROR)
58412580 64 return NULL;
1f3da8f8 65
58412580 66 return catalogue[error];
67}