lxc_config_define(cgroup_controller);
lxc_config_define(cgroup_dir);
lxc_config_define(console_logfile);
+lxc_config_define(console_logsize);
lxc_config_define(console_path);
lxc_config_define(environment);
lxc_config_define(ephemeral);
{ "lxc.cgroup.dir", false, set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
{ "lxc.cgroup", false, set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
{ "lxc.console.logfile", false, set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
+ { "lxc.console.logsize", false, set_config_console_logsize, get_config_console_logsize, clr_config_console_logsize, },
{ "lxc.console.path", false, set_config_console_path, get_config_console_path, clr_config_console_path, },
{ "lxc.environment", false, set_config_environment, get_config_environment, clr_config_environment, },
{ "lxc.ephemeral", false, set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
return set_config_path_item(&lxc_conf->console.log_path, value);
}
+static int set_config_console_logsize(const char *key, const char *value,
+ struct lxc_conf *lxc_conf, void *data)
+{
+ int ret;
+ int64_t size;
+ uint64_t logsize, pgsz;
+
+ if (lxc_config_value_empty(value)) {
+ lxc_conf->console.log_size = 0;
+ return 0;
+ }
+
+ /* If the user specified "auto" the default log size is 2^17 = 128 Kib */
+ if (!strcmp(value, "auto")) {
+ lxc_conf->console.log_size = 1 << 17;
+ return 0;
+ }
+
+ ret = parse_byte_size_string(value, &size);
+ if (ret < 0)
+ return -1;
+
+ if (size < 0)
+ return -EINVAL;
+
+ /* must be at least a page size */
+ pgsz = lxc_getpagesize();
+ if ((uint64_t)size < pgsz) {
+ NOTICE("Requested ringbuffer size for the console is %" PRId64
+ " but must be at least %" PRId64
+ " bytes. Setting ringbuffer size to %" PRId64 " bytes",
+ size, pgsz, pgsz);
+ size = pgsz;
+ }
+
+ logsize = lxc_find_next_power2((uint64_t)size);
+ if (logsize == 0)
+ return -EINVAL;
+
+ if (logsize != size)
+ NOTICE("Passed size was not a power of 2. Rounding log size to "
+ "next power of two: %" PRIu64 " bytes", logsize);
+
+ lxc_conf->console.log_size = logsize;
+ return 0;
+}
+
int append_unexp_config_line(const char *line, struct lxc_conf *conf)
{
size_t len = conf->unexpanded_len, linelen = strlen(line);
return lxc_get_conf_str(retv, inlen, c->console.log_path);
}
+static int get_config_console_logsize(const char *key, char *retv, int inlen,
+ struct lxc_conf *c, void *data)
+{
+ return lxc_get_conf_uint64(c, retv, inlen, c->autodev);
+}
+
static int get_config_seccomp_profile(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return 0;
}
+static inline int clr_config_console_logsize(const char *key,
+ struct lxc_conf *c, void *data)
+{
+ c->console.log_size = 0;
+ return 0;
+}
+
static inline int clr_config_seccomp_profile(const char *key,
struct lxc_conf *c, void *data)
{