2
* lxc: linux Container library
4
* (C) Copyright IBM Corp. 2007, 2008
7
* Daniel Lezcano <dlezcano at fr.ibm.com>
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.
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.
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
29
#include <sys/types.h>
31
#include <sys/mount.h>
35
static int mount_sysfs;
36
static int mount_procfs;
38
static struct option options[] = {
39
{ "mount-sysfs", no_argument, &mount_sysfs, 1 },
40
{ "mount-procfs", no_argument, &mount_procfs, 1 },
43
int main(int argc, char *argv[])
50
int ret = getopt_long_only(argc, argv, "", options, NULL);
59
fprintf(stderr, "missing command to launch\n");
63
aargv = &argv[optind];
73
if (mount_sysfs && mount("sysfs", "/sys", "sysfs", 0, NULL)) {
74
fprintf(stderr, "failed to mount '/sys'\n");
78
if (mount_procfs && mount("proc", "/proc", "proc", 0, NULL)) {
79
fprintf(stderr, "failed to mount '/proc'\n");
83
execvp(aargv[0], aargv);
84
fprintf(stderr, "failed to exec: %s\n", aargv[0]);
92
if (wait(&status) < 0) {
97
fprintf(stderr, "failed to wait child\n");