[lxc-devel] [lxc/master] clear ONLCR flag for container pty
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2430 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === now container pty output log, use \r\n as a newline flag. This is a windows type, so we need to change it. By clear ONLCR can reach it. Before do this. ``` # echo "" > /tmp/haozi.log # lxc-start -P /var/lib/lcrd/lcr -L /tmp/haozi.log --name haozi -- cat /proc/self/cgroup | od -c 000 # od -c /tmp/haozi.log 000 \n 1 2 : f i l e s : / l x c / h 020 a o z i \r \n 1 1 : p i d s : / l 040 x c / h a o z i \r \n 1 0 : m e m 060 o r y : / l x c / h a o z i \r \n 100 9 : h u g e t l b : / l x c / h 120 a o z i \r \n 8 : p e r f _ e v e 140 n t : / l x c / h a o z i \r \n 7 160 : c p u s e t : / l x c / h a o 200 z i \r \n 6 : d e v i c e s : / l 220 x c / h a o z i \r \n 5 : f r e e 240 z e r : / l x c / h a o z i \r \n 260 4 : b l k i o : / l x c / h a o 300 z i \r \n 3 : c p u a c c t , c p 320 u : / l x c / h a o z i \r \n 2 : 340 n e t _ p r i o , n e t _ c l s 360 : / l x c / h a o z i \r \n 1 : n 400 a m e = s y s t e m d : / l x c 420 / h a o z i \r \n ``` After we got this ``` # echo "" > /tmp/haozi.log # lxc-start -P /var/lib/lcrd/lcr -L /tmp/haozi.log --name haozi -- cat /proc/self/cgroup | od -c 000 # od -c /tmp/haozi.log 000 \n 1 2 : f i l e s : / l x c / h 020 a o z i \n 1 1 : p i d s : / l x 040 c / h a o z i \n 1 0 : m e m o r 060 y : / l x c / h a o z i \n 9 : h 100 u g e t l b : / l x c / h a o z 120 i \n 8 : p e r f _ e v e n t : / 140 l x c / h a o z i \n 7 : c p u s 160 e t : / l x c / h a o z i \n 6 : 200 d e v i c e s : / l x c / h a o 220 z i \n 5 : f r e e z e r : / l x 240 c / h a o z i \n 4 : b l k i o : 260 / l x c / h a o z i \n 3 : c p u 300 a c c t , c p u : / l x c / h a 320 o z i \n 2 : n e t _ p r i o , n 340 e t _ c l s : / l x c / h a o z 360 i \n 1 : n a m e = s y s t e m d 400 : / l x c / h a o z i \n ``` Signed-off-by: duguhaotian From 21930ebd9d08613863b29d220fd2ff7595fe1c63 Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Tue, 26 Jun 2018 09:57:04 +0800 Subject: [PATCH] clear ONLCR flag for container pty now container pty output log, use \r\n as a newline flag. This is a windows type, so we need to change it. By clear ONLCR can reach it. Signed-off-by: duguhaotian --- src/lxc/terminal.c | 13 + 1 file changed, 13 insertions(+) diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c index eb745c5ff..84a411d09 100644 --- a/src/lxc/terminal.c +++ b/src/lxc/terminal.c @@ -861,6 +861,7 @@ int lxc_terminal_create_log_file(struct lxc_terminal *terminal) int lxc_terminal_create(struct lxc_terminal *terminal) { int ret; + struct termios oldtios; ret = openpty(>master, >slave, terminal->name, NULL, NULL); if (ret < 0) { @@ -868,6 +869,18 @@ int lxc_terminal_create(struct lxc_terminal *terminal) return -1; } + ret = tcgetattr(terminal->master, ); + if (ret < 0) { + SYSERROR("Failed to get flag on terminal master"); + goto err; + } + oldtios.c_oflag &= ~ONLCR; + ret = tcsetattr(terminal->master, TCSAFLUSH, ); + if (ret < 0) { + SYSERROR("Failed to set flag on terminal master"); + goto err; + } + ret = fcntl(terminal->master, F_SETFD, FD_CLOEXEC); if (ret < 0) { SYSERROR("Failed to set FD_CLOEXEC flag on terminal master"); ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] support tls in cross-compile
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2362 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === AC_RUN_IFELSE will fail in cross-compile, we can use AC_COMPILE_IFELSE replace. Signed-off-by: duguhaotian From dcd2a5de4bbbc0a834eca83770385f9af29bd983 Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Wed, 30 May 2018 10:25:40 +0800 Subject: [PATCH] support tls in cross-compile AC_RUN_IFELSE will fail in cross-compile, we can use AC_COMPILE_IFELSE replace. Signed-off-by: duguhaotian --- config/tls.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/tls.m4 b/config/tls.m4 index 5d1ac5918..cd032c9d7 100644 --- a/config/tls.m4 +++ b/config/tls.m4 @@ -5,7 +5,7 @@ AC_DEFUN([LXC_CHECK_TLS], [ AC_MSG_CHECKING(for TLS) -AC_RUN_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ]) AC_MSG_RESULT($have_tls) if test "$have_tls" = "yes"; then AC_DEFINE([HAVE_TLS],[1],[Define if the compiler supports __thread]) ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] [log] support use container name as log_vmname
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2333 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === enhance readability of logs, use container name as log_vmname. Now we use log config to implement. But if we use API in mutl-threads, this function will failure. We can use thread-local variable to store container name, when we call lxc_container_new set this thread-local variable, and when we call lxc_container_put to free this thread-local variable. Signed-off-by: duguhaotianFrom c87c5d2963282ea2e7f730f708df51b19718adac Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Thu, 17 May 2018 16:51:55 +0800 Subject: [PATCH] [log] support use container name as log_vmname enhance readability of logs, use container name as log_vmname. Now we use log config to implement. But if we use API in mutl-threads, this function will failure. We can use thread-local variable to store container name, when we call lxc_container_new set this thread-local variable, and when we call lxc_container_put to free this thread-local variable. Signed-off-by: duguhaotian --- src/lxc/log.c | 29 +++-- src/lxc/log.h | 2 ++ src/lxc/lxccontainer.c | 2 ++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lxc/log.c b/src/lxc/log.c index 94b61d432..c20c7014e 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -65,6 +65,7 @@ static int lxc_loglevel_specified; static char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc"; static char *log_fname = NULL; static char *log_vmname = NULL; +static __thread char *container_name = NULL; lxc_log_define(lxc_log, lxc); @@ -99,7 +100,7 @@ static int lxc_log_priority_to_syslog(int priority) static int log_append_syslog(const struct lxc_log_appender *appender, struct lxc_log_event *event) { - char *msg; + char *msg, *tmp_cname; int rc, len; va_list args; @@ -118,10 +119,11 @@ static int log_append_syslog(const struct lxc_log_appender *appender, return 0; } + tmp_cname = container_name ? container_name : log_vmname; syslog(lxc_log_priority_to_syslog(event->priority), "%s%s %s - %s:%s:%d - %s" , - log_vmname ? log_vmname : "", - log_vmname ? ":" : "", + tmp_cname ? tmp_cname : "", + tmp_cname ? ":" : "", event->category, event->locinfo->file, event->locinfo->func, event->locinfo->line, @@ -134,10 +136,12 @@ static int log_append_syslog(const struct lxc_log_appender *appender, static int log_append_stderr(const struct lxc_log_appender *appender, struct lxc_log_event *event) { + char *tmp_cname; if (event->priority < LXC_LOG_LEVEL_ERROR) return 0; - fprintf(stderr, "%s: %s%s", log_prefix, log_vmname ? log_vmname : "", log_vmname ? ": " : ""); + tmp_cname = container_name ? container_name : log_vmname; + fprintf(stderr, "%s: %s%s", log_prefix, tmp_cname ? tmp_cname : "", tmp_cname ? ": " : ""); fprintf(stderr, "%s: %s: %d ", event->locinfo->file, event->locinfo->func, event->locinfo->line); vfprintf(stderr, event->fmt, *event->vap); fprintf(stderr, "\n"); @@ -270,6 +274,7 @@ static int log_append_logfile(const struct lxc_log_appender *appender, char date_time[LXC_LOG_TIME_SIZE]; int n, ret; int fd_to_use = -1; + char *tmp_cname; #ifndef NO_LXC_CONF if (!lxc_log_use_global_fd && current_config) @@ -285,11 +290,12 @@ static int log_append_logfile(const struct lxc_log_appender *appender, if (lxc_unix_epoch_to_utc(date_time, LXC_LOG_TIME_SIZE, >timestamp) < 0) return 0; + tmp_cname = container_name ? container_name : log_vmname; n = snprintf(buffer, sizeof(buffer), "%s%s%s %s %-8s %s - %s:%s:%d - ", log_prefix, - log_vmname ? " " : "", - log_vmname ? log_vmname : "", + tmp_cname ? " " : "", + tmp_cname ? tmp_cname : "", date_time, lxc_log_priority_to_string(event->priority), event->category, @@ -692,6 +698,17 @@ extern const char *lxc_log_get_file(void) return log_fname; } +extern void lxc_log_set_container_name(const char *name) +{ + container_name = strdup(name); +} + +extern void lxc_log_free_container_name() +{ + free(container_name); + container_name = NULL; +} + extern void lxc_log_set_prefix(const char *prefix) { /* We don't care if
[lxc-devel] [lxc/master] support case ignored suffix for sizes
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2315 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === suffix of console max size and console buffer max size Signed-off-by: l00355512From 39ebeb725b941323eac13d672eb4f94219b8399d Mon Sep 17 00:00:00 2001 From: l00355512 Date: Fri, 11 May 2018 09:47:49 +0800 Subject: [PATCH] support case ignored suffix for sizes suffix of console max size and console buffer max size Signed-off-by: l00355512 --- doc/lxc.container.conf.sgml.in | 18 ++ src/lxc/utils.c| 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index e9a013b8c..50fa76789 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -819,15 +819,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ringbuffer. Note that ringbuffer must be at least as big as a standard page size. When passed a value smaller than a single page size liblxc will allocate a ringbuffer of a single page size. A page -size is usually 4kB. +size is usually 4KB. The keyword 'auto' will cause liblxc to allocate a ringbuffer of -128kB. +128KB. When manually specifying a size for the ringbuffer the value should be a power of 2 when converted to bytes. Valid size prefixes are -'kB', 'MB', 'GB'. (Note that all conversions are based on multiples -of 1024. That means 'kb' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'.) +'KB', 'MB', 'GB'. (Note that all conversions are based on multiples +of 1024. That means 'KB' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'. + And ignored case, for example 'kB', 'KB' and 'Kb' is same.) @@ -843,15 +844,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA lxc.console.logfile. Note that size of the log file must be at least as big as a standard page size. When passed a value smaller than a single page size liblxc will set the size of log file -to a single page size. A page size is usually 4kB. +to a single page size. A page size is usually 4KB. -The keyword 'auto' will cause liblxc to place a limit of 128kB on +The keyword 'auto' will cause liblxc to place a limit of 128KB on the log file. When manually specifying a size for the log file the value should be a power of 2 when converted to bytes. Valid size prefixes are -'kB', 'MB', 'GB'. (Note that all conversions are based on multiples -of 1024. That means 'kb' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'.) +'KB', 'MB', 'GB'. (Note that all conversions are based on multiples +of 1024. That means 'KB' == 'KiB', 'MB' == 'MiB', 'GB' == 'GiB'. + And ignored case, for example 'kB', 'KB' and 'Kb' is same.) If users want to mirror the console ringbuffer on disk they should set lxc.console.size equal to diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 91bc802b4..b7651d055 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -2450,11 +2450,11 @@ int parse_byte_size_string(const char *s, int64_t *converted) return 0; } - if (!strcmp(suffix, "kB")) + if (!strcasecmp(suffix, "KB")) mltpl = 1024; - else if (!strcmp(suffix, "MB")) + else if (!strcasecmp(suffix, "MB")) mltpl = 1024 * 1024; - else if (!strcmp(suffix, "GB")) + else if (!strcasecmp(suffix, "GB")) mltpl = 1024 * 1024 * 1024; else return -EINVAL; ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] [log] wrong trace message
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2147 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === print wrong message Signed-off-by: duguhaotianFrom 3c1fb2e4c991f78b6feb298c868b2f2c09d66145 Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Fri, 9 Feb 2018 18:50:51 +0800 Subject: [PATCH] [log] wrong trace message print wrong message Signed-off-by: duguhaotian --- src/lxc/conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index affc41e16..82e0d62e3 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -396,7 +396,7 @@ int run_script_argv(const char *name, unsigned int hook_version, "LXC_HOOK_TYPE=%s", hookname); return -1; } - TRACE("Set environment variable: LXC_HOOK_TYPE=%s", section); + TRACE("Set environment variable: LXC_HOOK_TYPE=%s", hookname); ret = setenv("LXC_HOOK_SECTION", section, 1); if (ret < 0) { ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] [confile] wrong condition
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2124 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === if (file_exists(c->configfile) && !lxcapi_load_config(c, NULL)) goto err; if c->configfile is not exist, will donot call lxcapi_load_config. And not goto err, c->lxc_conf will not init. if user call size_t len = c->get_config_item(c, key, NULL, 0); will get a large length. ``` $ ./a.out befor len: 18446744073709551615 len: 18446744073709551615 ``` source code ``` int test_container(const char *name) { int ret = -1; struct lxc_container *c; char key[256] = "lxc.console.logfile"; /* Setup container struct */ c = lxc_container_new(name, NULL); if (!c) { fprintf(stderr, "Failed to setup lxc_container struct\n"); goto out; } size_t len = c->get_config_item(c, key, NULL, 0); printf("befor len: %lu\n", len); if (c->is_defined(c)) { fprintf(stderr, "Container already exists\n"); goto out; } len = c->get_config_item(c, key, NULL, 0); printf("len: %lu\n", len); out: lxc_container_put(c); return ret; } ``` Signed-off-by: duguhaotianFrom 67d188bc0f959306a2512718a576d8b3249ccbda Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Fri, 2 Feb 2018 20:02:44 +0800 Subject: [PATCH] [confile] wrong condition if (file_exists(c->configfile) && !lxcapi_load_config(c, NULL)) goto err; if c->configfile is not exist, will donot call lxcapi_load_config. And not goto err, c->lxc_conf will not init. if user call size_t len = c->get_config_item(c, key, NULL, 0); will get a large length. Signed-off-by: duguhaotian --- src/lxc/lxccontainer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 2a4bb51f3..27947fe1a 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -4675,7 +4675,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath goto err; } - if (file_exists(c->configfile) && !lxcapi_load_config(c, NULL)) { + if (!file_exists(c->configfile) && !lxcapi_load_config(c, NULL)) { fprintf(stderr, "Failed to load config for %s\n", name); goto err; } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] [cgfsng] show wrong errno
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2109 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === lxc_cgroup_set_data: h = get_hierarchy(controller); if h is NULL, now errno is old, it donot set new one. And then, cgfsng_setup_limits: if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) { if (do_devices && (errno == EACCES || errno == EPERM)) { WARN("Error setting %s to %s for %s", cg->subsystem, cg->value, d->name); continue; } SYSERROR("Error setting %s to %s for %s", cg->subsystem, cg->value, d->name); goto out; } SYSERROR will show old errno, make me confused. Signed-off-by: duguhaotianFrom d1953b26c87864808ce77958cccaeac69440fd17 Mon Sep 17 00:00:00 2001 From: duguhaotian Date: Fri, 26 Jan 2018 21:07:58 +0800 Subject: [PATCH] [cgfsng] show wrong errno lxc_cgroup_set_data: h = get_hierarchy(controller); if h is NULL, now errno is old, it donot set new one. And then, cgfsng_setup_limits: if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) { if (do_devices && (errno == EACCES || errno == EPERM)) { WARN("Error setting %s to %s for %s", cg->subsystem, cg->value, d->name); continue; } SYSERROR("Error setting %s to %s for %s", cg->subsystem, cg->value, d->name); goto out; } SYSERROR will show old errno, make me confused. Signed-off-by: duguhaotian --- src/lxc/cgroups/cgfsng.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 2d1ad4ebb..027d369e8 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2143,6 +2143,7 @@ static int lxc_cgroup_set_data(const char *filename, const char *value, struct c "The controller seems to be unused by \"cgfsng\" cgroup " "driver or not enabled on the cgroup hierarchy", controller); + errno = ENOENT; return -1; } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] Introducing lxc.console.buffer.rotate
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2091 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === #2088 add lxc.console.buffer.rotate From d819e20b8bfc765d7a34cbb1a25528cfe956a8f8 Mon Sep 17 00:00:00 2001 From: duguhaotianDate: Thu, 18 Jan 2018 11:33:11 +0800 Subject: [PATCH 1/2] [confile] add lxc.console.buffer.rotate Signed-off-by: duguhaotian --- doc/lxc.container.conf.sgml.in | 14 ++ src/lxc/conf.h | 3 +++ src/lxc/confile.c | 35 +++ 3 files changed, 52 insertions(+) diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index d106c9635..77b82b206 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -832,6 +832,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +lxc.console.buffer.rotate + + + + Whether to rotate the buffer logfile specified in + lxc.console.buffer.logfile. When ringbuffer is full, + will to rotate the logfile and dump the contents of the in-memory + ringbuffer to disk, and clear ringbuffer. + + + + lxc.console.buffer.logfile diff --git a/src/lxc/conf.h b/src/lxc/conf.h index 1146a1d4f..e408a092b 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -184,6 +184,9 @@ struct lxc_console { /* fd to the log file for the ringbuffer */ int buffer_log_file_fd; + /* whether to roate buffer log file */ + unsigned int buffer_rotate; + /* the in-memory ringbuffer */ struct lxc_ringbuf ringbuf; }; diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 3deec58bf..150aac8e8 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -85,6 +85,7 @@ lxc_config_define(cgroup_dir); lxc_config_define(console_logfile); lxc_config_define(console_rotate); lxc_config_define(console_buffer_logfile); +lxc_config_define(console_buffer_rotate); lxc_config_define(console_buffer_size); lxc_config_define(console_path); lxc_config_define(environment); @@ -156,6 +157,7 @@ static struct lxc_config_t config[] = { { "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.buffer.logfile",false, set_config_console_buffer_logfile, get_config_console_buffer_logfile, clr_config_console_buffer_logfile,}, + { "lxc.console.buffer.rotate", false, set_config_console_buffer_rotate, get_config_console_buffer_rotate, clr_config_console_buffer_rotate, }, { "lxc.console.buffer.size", false, set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, }, { "lxc.console.logfile", false, set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, }, { "lxc.console.path", false, set_config_console_path,get_config_console_path, clr_config_console_path, }, @@ -1973,6 +1975,26 @@ static int set_config_console_buffer_size(const char *key, const char *value, return 0; } +static int set_config_console_buffer_rotate(const char *key, const char *value, +struct lxc_conf *lxc_conf, void *data) +{ + if (lxc_config_value_empty(value)) { + lxc_conf->console.buffer_rotate = 0; + return 0; + } + + if (lxc_safe_uint(value, _conf->console.buffer_rotate) < 0) + return -1; + + if (lxc_conf->console.buffer_rotate > 1) { + ERROR("The \"lxc.console.buffer.rotate\" config key can only be set " + "to 0 or 1"); + return -1; + } + + return 0; +} + static int set_config_console_buffer_logfile(const char *key, const char *value, struct lxc_conf *lxc_conf, void *data) @@ -3279,6 +3301,12 @@ static int get_config_console_buffer_size(const char *key, char *retv, return lxc_get_conf_uint64(c,
[lxc-devel] [lxc/master] [console] return wrong console logsize
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2085 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === get_config_console_logsize want console.buffer_size not c->autodev From 548c71812526c2c7f5480ebefef0e2cdc736b71c Mon Sep 17 00:00:00 2001 From: duguhaotianDate: Tue, 16 Jan 2018 15:31:14 +0800 Subject: [PATCH] [console] return wrong console logsize get_config_console_logsize want console.buffer_size not c->autodev --- src/lxc/confile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 5bea71ae0..3deec58bf 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -3276,7 +3276,7 @@ static int get_config_console_buffer_size(const char *key, char *retv, int inlen, struct lxc_conf *c, void *data) { - return lxc_get_conf_uint64(c, retv, inlen, c->autodev); + return lxc_get_conf_uint64(c, retv, inlen, c->console.buffer_size); } static int get_config_console_buffer_logfile(const char *key, char *retv, ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] [monitor] wrong statement of break
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2048 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === if lxc_abstract_unix_connect fail and return -1, this code never goto retry. From 28818cb2949b3b6bffe5be0c550bc9998fbfe983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=AC=E5=AD=A4=E6=98=8A=E5=A4=A9?=Date: Mon, 18 Dec 2017 14:52:25 +0800 Subject: [PATCH] [monitor] wrong statement of break if lxc_abstract_unix_connect fail and return -1, this code never goto retry. --- src/lxc/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c index a16238992..6dcdd340d 100644 --- a/src/lxc/monitor.c +++ b/src/lxc/monitor.c @@ -232,7 +232,7 @@ int lxc_monitor_open(const char *lxcpath) for (retry = 0; retry < sizeof(backoff_ms) / sizeof(backoff_ms[0]); retry++) { fd = lxc_abstract_unix_connect(addr.sun_path); - if (fd < 0 || errno != ECONNREFUSED) + if (fd != -1 || errno != ECONNREFUSED) break; ERROR("Failed to connect to monitor socket. Retrying in %d ms: %s", backoff_ms[retry], strerror(errno)); usleep(backoff_ms[retry] * 1000); ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel