]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/error.c
Add return error status in the different functions
[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>
25#include "error.h"
26
27
28static char *catalogue[] = {
29 [LXC_ERROR_EMPTY] = "The container is not running",
e2bcd7db 30 [LXC_ERROR_ALREADY_EXISTS] = "The container already exists",
58412580 31 [LXC_ERROR_BUSY] = "The container is busy",
32 [LXC_ERROR_NOT_FOUND] = "The container was not found",
33 [LXC_ERROR_PERMISSION_DENIED] = "Permission denied",
34 [LXC_ERROR_WRONG_COMMAND] = "Wrong command",
35
36 [LXC_ERROR_CONF_CGROUP] = "Failed to configure the control group",
37 [LXC_ERROR_CONF_MOUNT] = "Failed to configure the mount points",
38 [LXC_ERROR_CONF_UTSNAME] = "Failed to configure the utsname",
39 [LXC_ERROR_CONF_NETWORK] = "Failed to configure the network",
40 [LXC_ERROR_CONF_ROOTFS] = "Failed to configure the root fs",
41
42 [LXC_ERROR_SETUP_CGROUP] = "Failed to setup the control group",
43 [LXC_ERROR_SETUP_MOUNT] = "Failed to setup the mount points",
44 [LXC_ERROR_SETUP_UTSNAME] = "Failed to setup the utsname",
45 [LXC_ERROR_SETUP_NETWORK] = "Failed to setup the network",
46 [LXC_ERROR_SETUP_ROOTFS] = "Failed to setup the root fs",
e2bcd7db 47
48 [LXC_ERROR_INTERNAL] = "Internal system error",
58412580 49};
50
51const char *const lxc_strerror(int error)
52{
53 if (error < 0 || error >= LXC_LAST_ERROR)
54 return NULL;
55 return catalogue[error];
56}