return lxc_setup_ttydir_console(rootfs, console, ttydir);
}
-static int setup_kmsg(const struct lxc_rootfs *rootfs,
- const struct lxc_console *console)
-{
- char kpath[MAXPATHLEN];
- int ret;
-
- if (!rootfs->path)
- return 0;
- ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount);
- if (ret < 0 || ret >= sizeof(kpath))
- return -1;
-
- ret = unlink(kpath);
- if (ret && errno != ENOENT) {
- SYSERROR("error unlinking %s", kpath);
- return -1;
- }
-
- ret = symlink("console", kpath);
- if (ret) {
- SYSERROR("failed to create symlink for kmsg");
- return -1;
- }
-
- return 0;
-}
-
static void parse_mntopt(char *opt, unsigned long *flags, char **data)
{
struct mount_opt *mo;
free(new);
return NULL;
}
- new->kmsg = 0;
new->logfd = -1;
lxc_list_init(&new->cgroup);
lxc_list_init(&new->network);
return -1;
}
- if (lxc_conf->kmsg) {
- if (setup_kmsg(&lxc_conf->rootfs, &lxc_conf->console)) // don't fail
- ERROR("failed to setup kmsg for '%s'", name);
- }
-
if (!lxc_conf->is_execute && setup_dev_symlinks(&lxc_conf->rootfs)) {
ERROR("failed to setup /dev symlinks for '%s'", name);
return -1;
void *);
static int clr_config_ttydir(const char *, struct lxc_conf *, void *);
-static int set_config_kmsg(const char *, const char *, struct lxc_conf *,
- void *);
-static int get_config_kmsg(const char *, char *, int, struct lxc_conf *,
- void *);
-static int clr_config_kmsg(const char *, struct lxc_conf *, void *);
-
static int set_config_apparmor_profile(const char *, const char *,
struct lxc_conf *, void *);
static int get_config_apparmor_profile(const char *, char *, int,
{ "lxc.pts", set_config_pts, get_config_pts, clr_config_pts, },
{ "lxc.tty", set_config_tty, get_config_tty, clr_config_tty, },
{ "lxc.devttydir", set_config_ttydir, get_config_ttydir, clr_config_ttydir, },
- { "lxc.kmsg", set_config_kmsg, get_config_kmsg, clr_config_kmsg, },
{ "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
{ "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
{ "lxc.selinux.context", set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
NAME_MAX + 1);
}
-static int set_config_kmsg(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- /* Set config value to default. */
- if (lxc_config_value_empty(value)) {
- lxc_conf->kmsg = 0;
- return 0;
- }
-
- /* Parse new config value. */
- if (lxc_safe_uint(value, &lxc_conf->kmsg) < 0)
- return -1;
-
- if (lxc_conf->kmsg > 1)
- return -1;
-
- return 0;
-}
-
static int set_config_apparmor_profile(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
return lxc_get_conf_str(retv, inlen, c->ttydir);
}
-static int get_config_kmsg(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return lxc_get_conf_int(c, retv, inlen, c->kmsg);
-}
-
static int get_config_apparmor_profile(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return 0;
}
-static inline int clr_config_kmsg(const char *key, struct lxc_conf *c,
- void *data)
-{
- c->kmsg = 0;
- return 0;
-}
-
static inline int clr_config_apparmor_profile(const char *key,
struct lxc_conf *c, void *data)
{