]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add some traces in the code for the logger
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 24 Jul 2009 13:25:45 +0000 (15:25 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 24 Jul 2009 13:25:45 +0000 (15:25 +0200)
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 <dlezcano@fr.ibm.com>
src/lxc/cgroup.c
src/lxc/conf.c
src/lxc/start.c
src/lxc/state.c

index c2aa691ce3ecf60397faea6aff132314175c695d..d055eaac5440174940894b684835407e388884ea 100644 (file)
@@ -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);
 }
 
index 41e79451426343dbec62a02e7febece63551c5ff..83ea2c33110dd6024f4e7d42527dc0b4df5782b1 100644 (file)
@@ -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;
 
index 53df79b0a7ebc247b60fc992889d172bc7ca9064..709b8f7619e1c9f932d3944e86a2be4950a75a20 100644 (file)
@@ -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]);
index a817a53a61fec630f0b2b2f85fbb0a3a2d55f685..e164e0e52a7cd6d6f59fffc723aba1f520f81ce2 100644 (file)
@@ -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);