the line is a comment.
</para>
+ <refsect2>
+ <title>Architecture</title>
+ <para>
+ Allows to set the architecture for the container. For example,
+ set a 32bits architecture for a container running 32bits
+ binaries on a 64bits host. That fix the container scripts
+ which rely on the architecture to do some work like
+ downloading the packages.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <option>lxc.arch</option>
+ </term>
+ <listitem>
+ <para>
+ Specify the architecture for the container.
+ </para>
+ <para>
+ Valid options are
+ <option>x86</option>,
+ <option>i686</option>,
+ <option>x86_64</option>,
+ <option>amd64</option>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect2>
+
<refsect2>
<title>Hostname</title>
<para>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/capability.h>
+#include <sys/personality.h>
#include <arpa/inet.h>
#include <fcntl.h>
return 0;
}
+static int setup_personality(int persona)
+{
+ if (persona == -1)
+ return 0;
+
+ if (personality(persona) < 0) {
+ SYSERROR("failed to set personality to '0x%x'", persona);
+ return -1;
+ }
+
+ INFO("set personality to '0x%x'", persona);
+
+ return 0;
+}
+
static int setup_console(const struct lxc_rootfs *rootfs,
const struct lxc_console *console)
{
}
memset(new, 0, sizeof(*new));
+ new->personality = -1;
new->console.path = NULL;
new->console.peer = -1;
new->console.master = -1;
return -1;
}
+ if (setup_personality(lxc_conf->personality)) {
+ ERROR("failed to setup personality");
+ return -1;
+ }
+
if (setup_caps(&lxc_conf->caps)) {
ERROR("failed to drop capabilities");
return -1;
#include <sys/types.h>
#include <sys/param.h>
#include <sys/utsname.h>
+#include <sys/personality.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <net/if.h>
lxc_log_define(lxc_confile, lxc);
+static int config_personality(const char *, char *, struct lxc_conf *);
static int config_pts(const char *, char *, struct lxc_conf *);
static int config_tty(const char *, char *, struct lxc_conf *);
static int config_cgroup(const char *, char *, struct lxc_conf *);
static struct config config[] = {
+ { "lxc.arch", config_personality },
{ "lxc.pts", config_pts },
{ "lxc.tty", config_tty },
{ "lxc.cgroup", config_cgroup },
return 0;
}
+static int config_personality(const char *key, char *value,
+ struct lxc_conf *lxc_conf)
+{
+ struct per_name {
+ char *name;
+ int per;
+ } pername[4] = {
+ { "x86", PER_LINUX32 },
+ { "i686", PER_LINUX32 },
+ { "x86_64", PER_LINUX },
+ { "amd64", PER_LINUX },
+ };
+
+ int i;
+
+ for (i = 0; i < sizeof(pername); i++) {
+
+ if (strcmp(pername[i].name, value))
+ continue;
+
+ lxc_conf->personality = pername[i].per;
+ return 0;
+ }
+
+ ERROR("unsupported personality '%s'", value);
+ return -1;
+}
+
static int config_pts(const char *key, char *value, struct lxc_conf *lxc_conf)
{
int maxpts = atoi(value);