Commit 1ac470c0 by Daniel Lezcano

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent f5d18611
...@@ -74,6 +74,8 @@ static int get_cgroup_mount(const char *mtab, char *mnt) ...@@ -74,6 +74,8 @@ static int get_cgroup_mount(const char *mtab, char *mnt)
} }
}; };
DEBUG("using cgroup mounted at '%s'", mnt);
fclose(file); fclose(file);
out: out:
return err; return err;
...@@ -108,6 +110,9 @@ int lxc_rename_nsgroup(const char *name, pid_t pid) ...@@ -108,6 +110,9 @@ int lxc_rename_nsgroup(const char *name, pid_t pid)
ret = rename(oldname, newname); ret = rename(oldname, newname);
if (ret) if (ret)
SYSERROR("failed to rename cgroup %s->%s", oldname, newname); SYSERROR("failed to rename cgroup %s->%s", oldname, newname);
else
DEBUG("'%s' renamed to '%s'", oldname, newname);
return ret; return ret;
} }
...@@ -130,7 +135,10 @@ int lxc_link_nsgroup(const char *name) ...@@ -130,7 +135,10 @@ int lxc_link_nsgroup(const char *name)
ret = symlink(nsgroup, lxc); ret = symlink(nsgroup, lxc);
if (ret) if (ret)
SYSERROR("failed to create symlink %s->%s", nsgroup, lxc); 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) int lxc_unlink_nsgroup(const char *name)
...@@ -147,6 +155,8 @@ int lxc_unlink_nsgroup(const char *name) ...@@ -147,6 +155,8 @@ int lxc_unlink_nsgroup(const char *name)
rmdir(path); rmdir(path);
} }
DEBUG("unlinking '%s'", nsgroup);
return unlink(nsgroup); return unlink(nsgroup);
} }
......
...@@ -1779,6 +1779,9 @@ int lxc_create_tty(const char *name, struct lxc_tty_info *tty_info) ...@@ -1779,6 +1779,9 @@ int lxc_create_tty(const char *name, struct lxc_tty_info *tty_info)
} }
ret = 0; ret = 0;
INFO("tty's configured");
out: out:
return ret; return ret;
......
...@@ -136,6 +136,8 @@ static int setup_sigchld_fd(sigset_t *oldmask) ...@@ -136,6 +136,8 @@ static int setup_sigchld_fd(sigset_t *oldmask)
return -1; return -1;
} }
DEBUG("sigchild handler set");
return fd; return fd;
} }
...@@ -166,6 +168,8 @@ static int setup_tty_service(const char *name, int *ttyfd) ...@@ -166,6 +168,8 @@ static int setup_tty_service(const char *name, int *ttyfd)
static int sigchld_handler(int fd, void *data, static int sigchld_handler(int fd, void *data,
struct lxc_epoll_descr *descr) struct lxc_epoll_descr *descr)
{ {
DEBUG("child exited");
return 1; return 1;
} }
...@@ -381,6 +385,9 @@ static int console_init(char *console, size_t size) ...@@ -381,6 +385,9 @@ static int console_init(char *console, size_t size)
} }
console[0] = '\0'; console[0] = '\0';
DEBUG("console initialized");
return 0; return 0;
} }
...@@ -428,6 +435,9 @@ struct lxc_handler *lxc_init(const char *name) ...@@ -428,6 +435,9 @@ struct lxc_handler *lxc_init(const char *name)
LXC_TTY_ADD_HANDLER(SIGQUIT); LXC_TTY_ADD_HANDLER(SIGQUIT);
out: out:
if (handler)
INFO("'%s' is initialized", name);
return handler; return handler;
out_delete_tty: out_delete_tty:
...@@ -517,6 +527,8 @@ static int do_start(void *arg) ...@@ -517,6 +527,8 @@ static int do_start(void *arg)
goto out_child; goto out_child;
} }
NOTICE("exec'ing '%s'", argv[0]);
execvp(argv[0], argv); execvp(argv[0], argv);
SYSERROR("failed to exec %s", argv[0]); SYSERROR("failed to exec %s", argv[0]);
...@@ -601,6 +613,8 @@ int lxc_spawn(const char *name, struct lxc_handler *handler, char *const argv[]) ...@@ -601,6 +613,8 @@ int lxc_spawn(const char *name, struct lxc_handler *handler, char *const argv[])
err = 0; err = 0;
NOTICE("'%s' started with pid '%d'", argv[0], handler->pid);
out_close: out_close:
close(sv[0]); close(sv[0]);
close(sv[1]); close(sv[1]);
......
...@@ -93,6 +93,8 @@ int lxc_setstate(const char *name, lxc_state_t state) ...@@ -93,6 +93,8 @@ int lxc_setstate(const char *name, lxc_state_t state)
} }
err = 0; err = 0;
DEBUG("set state to '%s'", str);
out: out:
close(fd); close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment