]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/lxc_start.c
Add setpcap capabilty to be able to drop the sys_boot capabilty.
[mirror_lxc.git] / src / lxc / lxc_start.c
CommitLineData
5e97c3fc 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#include <stdio.h>
24#include <libgen.h>
25#include <unistd.h>
26#include <string.h>
27#include <sys/param.h>
28#include <sys/utsname.h>
29#include <sys/types.h>
30#include <sys/socket.h>
31#include <arpa/inet.h>
32#include <netinet/in.h>
33#include <net/if.h>
34
b113348e 35#include <lxc/lxc.h>
5e97c3fc 36
37void usage(char *cmd)
38{
39 fprintf(stderr, "%s <command>\n", basename(cmd));
40 fprintf(stderr, "\t -n <name> : name of the container\n");
41 _exit(1);
42}
43
44int main(int argc, char *argv[])
45{
46 char opt;
47 char *name = NULL;
48 char **args;
49 int nbargs = 0;
50
51 while ((opt = getopt(argc, argv, "n:")) != -1) {
52 switch (opt) {
53 case 'n':
54 name = optarg;
55 break;
56 }
57
58 nbargs++;
59 }
60
61 if (!name || !argv[optind] || !strlen(argv[optind]))
62 usage(argv[0]);
63
64 args = &argv[optind];
65 argc -= nbargs;
66
05f05512 67 if (lxc_start(name, args)) {
5e97c3fc 68 fprintf(stderr, "failed to start %s\n", name);
69 return 1;
70 }
71
72 return 0;
73}
74