Skip to content
This repository
Browse code

Make /dev/kmsg symlinking optional, add lxc.kmsg option

Had this changeset hanging around for some time, maybe this would be useful
until some better solution come up.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information...
commit 7e0e1d941d4b0fbca53fd9aba3aafa9745119b53 1 parent 23622a2
 Alexander Vladimirov idkfa authored Serge Hallyn committed

Showing 3 changed files with 17 additions and 2 deletions. Show diff stats Hide diff stats

  1. +4 2 src/lxc/conf.c
  2. +1 0  src/lxc/conf.h
  3. +12 0 src/lxc/confile.c
6 src/lxc/conf.c
@@ -2768,8 +2768,10 @@ int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
2768 2768 return -1;
2769 2769 }
2770 2770
2771   - if (setup_kmsg(&lxc_conf->rootfs, &lxc_conf->console)) // don't fail
2772   - ERROR("failed to setup kmsg for '%s'", name);
  2771 + if (lxc_conf->kmsg) {
  2772 + if (setup_kmsg(&lxc_conf->rootfs, &lxc_conf->console)) // don't fail
  2773 + ERROR("failed to setup kmsg for '%s'", name);
  2774 + }
2773 2775
2774 2776 if (setup_tty(&lxc_conf->rootfs, &lxc_conf->tty_info, lxc_conf->ttydir)) {
2775 2777 ERROR("failed to setup the ttys for '%s'", name);
1  src/lxc/conf.h
@@ -278,6 +278,7 @@ struct lxc_conf {
278 278 int maincmd_fd;
279 279 int autodev; // if 1, mount and fill a /dev at start
280 280 int stopsignal; // signal used to stop container
  281 + int kmsg; // if 1, create /dev/kmsg symlink
281 282 char *rcfile; // Copy of the top level rcfile we read
282 283 };
283 284
12 src/lxc/confile.c
@@ -56,6 +56,7 @@ static int config_personality(const char *, const char *, struct lxc_conf *);
56 56 static int config_pts(const char *, const char *, struct lxc_conf *);
57 57 static int config_tty(const char *, const char *, struct lxc_conf *);
58 58 static int config_ttydir(const char *, const char *, struct lxc_conf *);
  59 +static int config_kmsg(const char *, const char *, struct lxc_conf *);
59 60 #if HAVE_APPARMOR
60 61 static int config_aa_profile(const char *, const char *, struct lxc_conf *);
61 62 #endif
@@ -97,6 +98,7 @@ static struct lxc_config_t config[] = {
97 98 { "lxc.pts", config_pts },
98 99 { "lxc.tty", config_tty },
99 100 { "lxc.devttydir", config_ttydir },
  101 + { "lxc.kmsg", config_kmsg },
100 102 #if HAVE_APPARMOR
101 103 { "lxc.aa_profile", config_aa_profile },
102 104 #endif
@@ -933,6 +935,16 @@ static int config_ttydir(const char *key, const char *value,
933 935 return 0;
934 936 }
935 937
  938 +static int config_kmsg(const char *key, const char *value,
  939 + struct lxc_conf *lxc_conf)
  940 +{
  941 + int v = atoi(value);
  942 +
  943 + lxc_conf->kmsg = v;
  944 +
  945 + return 0;
  946 +}
  947 +
936 948 #if HAVE_APPARMOR
937 949 static int config_aa_profile(const char *key, const char *value,
938 950 struct lxc_conf *lxc_conf)

0 comments on commit 7e0e1d9

Please sign in to comment.
Something went wrong with that request. Please try again.