confile.c revision 858377e4d968c8a7254e22dc7167acf76ac91a48
525421c923d798cdea9e5691bcee1e5e5530491dStéphane Graber * lxc: linux Container library
fd5c4f905861964cb473cf3df3336447a9365962Stéphane Graber * (C) Copyright IBM Corp. 2007, 2008
16216c83297543692b8dede52c9dd8a998758e9cStéphane Graber * Daniel Lezcano <daniel.lezcano at free.fr>
16216c83297543692b8dede52c9dd8a998758e9cStéphane Graber * This library is free software; you can redistribute it and/or
16216c83297543692b8dede52c9dd8a998758e9cStéphane Graber * modify it under the terms of the GNU Lesser General Public
16216c83297543692b8dede52c9dd8a998758e9cStéphane Graber * License as published by the Free Software Foundation; either
16216c83297543692b8dede52c9dd8a998758e9cStéphane Graber * version 2.1 of the License, or (at your option) any later version.
afeecbba0359d2b4404cdf896e6b6d0b5a8443b0Serge Hallyn * This library is distributed in the hope that it will be useful,
ae5c8b8ed5feb9a47c5007c986ce01ea39b5075fSerge Hallyn * but WITHOUT ANY WARRANTY; without even the implied warranty of
9be53773792fc9e8bd173edc3b7ac7e144875387Serge Hallyn * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0115f8fd27b1a31d367bb161a121694f92b45e62Dwight Engen * Lesser General Public License for more details.
20ab58c777136a449b3199e0733b62fa87ecfa61Serge Hallyn * You should have received a copy of the GNU Lesser General Public
f5dd1d532a76a1b57cf341db821eae85ea1118c5Serge Hallyn * License along with this library; if not, write to the Free Software
72d0e1cb2facaa4b8ba2f15e311d6bb9491badb7Stéphane Graber * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
struct signame {
int num;
const char *name;
for (i = 0; i < config_size; i++)
return &config[i];
return NULL;
if (inlen > 0) { \
if (!retv)
inlen = 0;
for (i = 0; i < config_size; i++) {
return fulllen;
char *new_value;
if (!new_value) {
if (!copy) {
goto out;
goto out;
if (!config) {
goto out;
out:
return ret;
if (!netdev) {
if (!list) {
return idx;
return NULL;
if (idx == i++) {
return netdev;
if (!netdev)
if (!retv)
inlen = 0;
case LXC_NET_VETH:
case LXC_NET_MACVLAN:
case LXC_NET_VLAN:
case LXC_NET_PHYS:
return fulllen;
return NULL;
if (!netdev) {
return NULL;
return netdev;
#ifndef MACVLAN_MODE_PRIVATE
#ifndef MACVLAN_MODE_VEPA
#ifndef MACVLAN_MODE_BRIDGE
struct mc_mode {
char *name;
int mode;
#ifndef HAVE_RAND_R
randseed(true);
#ifdef HAVE_RAND_R
curs++;
if (!netdev)
if (!netdev)
if (!netdev)
if (!netdev)
if (!netdev)
if (!new_value) {
if (!netdev) {
if (!netdev)
if (!netdev)
if (!netdev)
if (!inetdev) {
if (!list) {
if (!addr) {
if (cursor) {
if (slash) {
if (!bcast) {
if (!netdev)
if (!gw) {
char *netmask;
if (!netdev)
if (!inet6dev) {
if (!list) {
if (!valdup) {
if (slash) {
if (!netdev)
if (!gw) {
if (!netdev)
if (!netdev)
if (!hooklist) {
char *copy;
if (!copy) {
if (personality >= 0)
if (!groups) {
if (!token) {
ret = 0;
if (!grouplist) {
return ret;
if (!list_item)
goto freak_out;
goto freak_out;
struct lxc_conf *c)
int ret;
if (ret == 0)
return ret;
int newlevel;
errno = 0;
int sig_n = 0;
int rtmax = 0;
return sig_n;
if (sig_n < 0)
if (sig_n < 0)
if (sig_n < 0)
char *subkey;
if (!subkey)
if (!cglist)
goto out;
if (!cgelem)
goto out;
goto out;
out:
if (cgelem) {
char *subkey;
char type;
int ret;
if (!subkey)
if (!idmaplist)
goto out;
if (!idmap)
goto out;
goto out;
goto out;
out:
if (idmap) {
{ NULL, 0 }
if (!autos) {
if (!token) {
ret = 0;
return ret;
char *subkey;
char *mntelem;
if (!subkey) {
if (!subkey) {
if (!subkey)
if (!mntlist)
if (!mntelem) {
if (!keepcaps) {
if (!token) {
ret = 0;
if (!keeplist) {
return ret;
if (!dropcaps) {
if (!token) {
ret = 0;
if (!droplist) {
return ret;
* If we find a lxc.network.hwaddr in the original config file,
while (isblank(*p))
if (!tmp)
if (!dir) {
const char *fnam;
if (!direntp)
goto out;
if (ret < 0)
goto out;
ret = 0;
out:
return ret;
if (!utsname) {
value);
struct parse_line_conf {
bool from_include;
char *dot;
char *key;
char *value;
int ret = 0;
if (!line) {
goto out;
goto out;
goto out;
if (!dot) {
goto out;
if (!config) {
goto out;
out:
return ret;
struct parse_line_conf c;
c.from_include = false;
struct parse_line_conf c;
if (!dent)
int ret = 0;
if (ret)
return ret;
struct per_name {
char *name;
unsigned long per;
} pername[] = {
for (i = 0; i < len; i++) {
int i, aflag;
{ NULL, 0 }
if (!flaglist) {
while (token) {
if (aflag < 0)
if (!retv)
inlen = 0;
int fulllen = 0;
if (!retv)
inlen = 0;
int len = 0;
switch(c->personality) {
return fulllen;
* If you ask for a specific cgroup value, i.e. lxc.cgroup.devices.list,
* If you ask for 'lxc.cgroup", then all cgroup entries will be printed,
* in 'lxc.cgroup.subsystem.key = value' format.
const char *key)
int all = 0;
if (!retv)
inlen = 0;
if (all) {
return fulllen;
const char *key)
char *subkey;
/* "lxc.hook.mount" */
if (!subkey)
subkey++;
if (!*subkey)
for (i=0; i<NUM_LXC_HOOKS; i++) {
found=i;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
if (!retv)
inlen = 0;
case LXC_AUTO_CGROUP_FULL_MIXED: strprint(retv, inlen, "%scgroup-full:mixed", sep); sep = " "; break;
return fulllen;
const char *key)
char *p1;
if (!retv)
inlen = 0;
p1++;
if (!netdev)
const char *mode;
return fulllen;
if (!retv)
inlen = 0;
return fulllen;
int inlen)
const char *v = NULL;
v = c->fstab;
v = c->ttydir;
v = c->lsm_aa_profile;
v = c->lsm_se_context;
v = c->logfile;
v = c->seccomp;
v = c->init_cmd;
return strlen(v);
return lxc_clear_config_network(c);
return lxc_clear_config_caps(c);
return lxc_clear_config_keepcaps(c);
return lxc_clear_mount_entries(c);
return lxc_clear_automounts(c);
return lxc_clear_groups(c);
return lxc_clear_environment(c);
return lxc_clear_idmaps(c);
int ret;
if (!len)
int ret;
while (*lstart) {
if (!lend)
lend++;
if (!rm_subkeys) {
int ret;
while (*lstart) {
if (!lend)
lend++;
while (isblank(*p))
char *new;
if (!new) {
if (!(cmd)) { \
FILE *f;
unsigned int seed;
fclose(f);
while (*lstart) {
if (!lend)
lend++;
while (isblank(*p))
p2 = p;
p2++;