From: Daniel Lezcano Date: Fri, 24 Jul 2009 13:25:45 +0000 (+0200) Subject: add some traces in the code for the logger X-Git-Tag: lxc_0_6_3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ac470c02ad23fef754e1e4d6dfdbf4e1446cc3b;p=thirdparty%2Flxc.git add some traces in the code for the logger Add some traces in the code, so we are able to follow the execution of the start command with the logger. Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index c2aa691ce..d055eaac5 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -74,6 +74,8 @@ static int get_cgroup_mount(const char *mtab, char *mnt) } }; + DEBUG("using cgroup mounted at '%s'", mnt); + fclose(file); out: return err; @@ -108,6 +110,9 @@ int lxc_rename_nsgroup(const char *name, pid_t pid) ret = rename(oldname, newname); if (ret) SYSERROR("failed to rename cgroup %s->%s", oldname, newname); + else + DEBUG("'%s' renamed to '%s'", oldname, newname); + return ret; } @@ -130,7 +135,10 @@ int lxc_link_nsgroup(const char *name) ret = symlink(nsgroup, lxc); if (ret) SYSERROR("failed to create symlink %s->%s", nsgroup, lxc); - return ret; + else + DEBUG("'%s' linked to '%s'", nsgroup, lxc); + + return ret; } int lxc_unlink_nsgroup(const char *name) @@ -147,6 +155,8 @@ int lxc_unlink_nsgroup(const char *name) rmdir(path); } + DEBUG("unlinking '%s'", nsgroup); + return unlink(nsgroup); } diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 41e794514..83ea2c331 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1779,6 +1779,9 @@ int lxc_create_tty(const char *name, struct lxc_tty_info *tty_info) } ret = 0; + + INFO("tty's configured"); + out: return ret; diff --git a/src/lxc/start.c b/src/lxc/start.c index 53df79b0a..709b8f761 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -136,6 +136,8 @@ static int setup_sigchld_fd(sigset_t *oldmask) return -1; } + DEBUG("sigchild handler set"); + return fd; } @@ -166,6 +168,8 @@ static int setup_tty_service(const char *name, int *ttyfd) static int sigchld_handler(int fd, void *data, struct lxc_epoll_descr *descr) { + DEBUG("child exited"); + return 1; } @@ -381,6 +385,9 @@ static int console_init(char *console, size_t size) } console[0] = '\0'; + + DEBUG("console initialized"); + return 0; } @@ -428,6 +435,9 @@ struct lxc_handler *lxc_init(const char *name) LXC_TTY_ADD_HANDLER(SIGQUIT); out: + if (handler) + INFO("'%s' is initialized", name); + return handler; out_delete_tty: @@ -517,6 +527,8 @@ static int do_start(void *arg) goto out_child; } + NOTICE("exec'ing '%s'", argv[0]); + execvp(argv[0], argv); SYSERROR("failed to exec %s", argv[0]); @@ -601,6 +613,8 @@ int lxc_spawn(const char *name, struct lxc_handler *handler, char *const argv[]) err = 0; + NOTICE("'%s' started with pid '%d'", argv[0], handler->pid); + out_close: close(sv[0]); close(sv[1]); diff --git a/src/lxc/state.c b/src/lxc/state.c index a817a53a6..e164e0e52 100644 --- a/src/lxc/state.c +++ b/src/lxc/state.c @@ -93,6 +93,8 @@ int lxc_setstate(const char *name, lxc_state_t state) } err = 0; + + DEBUG("set state to '%s'", str); out: close(fd);