<div>Hi, this commit and about 8 others haven't showed up in SourceForge's git tree.</div><div><br></div><div><div><a href="http://lxc.git.sourceforge.net/git/gitweb.cgi?p=lxc/lxc;a=summary">http://lxc.git.sourceforge.net/git/gitweb.cgi?p=lxc/lxc;a=summary</a></div>
</div><div><br></div><div>Is there another git tree that the project is using?</div><div><br></div><div>Thanks,</div><div><br></div><div>    - Scott</div><div><br></div><br><div class="gmail_quote">On Sun, Oct 3, 2010 at 2:46 PM, Daniel Lezcano <span dir="ltr"><<a href="mailto:daniel.lezcano@free.fr">daniel.lezcano@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The <rootfs>/var/run/utmp is located in:<br>
<br>
/proc/<containerinit>/root/var/run/utmp, let's use it.<br>
<br>
Signed-off-by: Daniel Lezcano <<a href="mailto:dlezcano@fr.ibm.com">dlezcano@fr.ibm.com</a>><br>
---<br>
 src/lxc/utmp.c |   30 +++++++++++++++++++-----------<br>
 1 files changed, 19 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/src/lxc/utmp.c b/src/lxc/utmp.c<br>
index dca9d72..e6249ce 100644<br>
--- a/src/lxc/utmp.c<br>
+++ b/src/lxc/utmp.c<br>
@@ -82,8 +82,10 @@ static int utmp_handler(int fd, void *data, struct lxc_epoll_descr *descr)<br>
<br>
        struct lxc_utmp *utmp_data = (struct lxc_utmp *)data;<br>
<br>
-       /* we're monitoring a directory. ie->name is not included in sizeof(struct inotify_event)<br>
-        * if we don't read it all at once, read gives us EINVAL, so we read and cast to struct ie<br>
+       /*<br>
+        * we're monitoring a directory. ie->name is not included in<br>
+        * sizeof(struct inotify_event) if we don't read it all at once,<br>
+        * read gives us EINVAL, so we read and cast to struct ie<br>
         */<br>
        char buffer[MAXPATHLEN];<br>
<br>
@@ -100,7 +102,13 @@ static int utmp_handler(int fd, void *data, struct lxc_epoll_descr *descr)<br>
        ie = (struct inotify_event *)buffer;<br>
<br>
        if (ie->len <= 0) {<br>
-               SYSERROR("inotify event with no name");<br>
+<br>
+               if (ie->mask & IN_UNMOUNT) {<br>
+                       DEBUG("watched directory removed");<br>
+                       goto out;<br>
+               }<br>
+<br>
+               SYSERROR("inotify event with no name (mask %d)", ie->mask);<br>
                return -1;<br>
        }<br>
<br>
@@ -161,10 +169,9 @@ static int utmp_get_runlevel(struct lxc_utmp *utmp_data)<br>
        struct utmpx *utmpx;<br>
        char path[MAXPATHLEN];<br>
        struct lxc_handler *handler = utmp_data->handler;<br>
-       struct lxc_conf *conf = handler->conf;<br>
<br>
-       if (snprintf(path, MAXPATHLEN, "%s/var/run/utmp", conf->rootfs.path) ><br>
-           MAXPATHLEN) {<br>
+       if (snprintf(path, MAXPATHLEN, "/proc/%d/root/var/run/utmp",<br>
+                    handler->pid) > MAXPATHLEN) {<br>
                ERROR("path is too long");<br>
                return -1;<br>
        }<br>
@@ -211,19 +218,20 @@ static int utmp_get_ntasks(struct lxc_handler *handler)<br>
 int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,<br>
                          struct lxc_handler *handler)<br>
 {<br>
-       struct lxc_conf *conf = handler->conf;<br>
        char path[MAXPATHLEN];<br>
        int fd, wd;<br>
        struct lxc_utmp *utmp_data;<br>
+       struct lxc_conf *conf = handler->conf;<br>
<br>
        if (!conf->rootfs.path)<br>
                return 0;<br>
<br>
-       /* We set up a watch for the /var/run directory. We're only interested in<br>
-        * utmp at the moment, but want to watch for delete and create events as well.<br>
+       /* We set up a watch for the /var/run directory. We're only interested<br>
+        * in utmp at the moment, but want to watch for delete and create<br>
+        * events as well.<br>
         */<br>
-       if (snprintf(path, MAXPATHLEN, "%s/var/run", conf->rootfs.path) ><br>
-           MAXPATHLEN) {<br>
+       if (snprintf(path, MAXPATHLEN, "/proc/%d/root/var/run",<br>
+                    handler->pid) > MAXPATHLEN) {<br>
                ERROR("path is too long");<br>
                return -1;<br>
        }<br>
--<br>
1.7.0.4<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Virtualization is moving to the mainstream and overtaking non-virtualized<br>
environment for deploying applications. Does it make network security<br>
easier or more difficult to achieve? Read this whitepaper to separate the<br>
two and get a better understanding.<br>
<a href="http://p.sf.net/sfu/hp-phase2-d2d" target="_blank">http://p.sf.net/sfu/hp-phase2-d2d</a><br>
_______________________________________________<br>
Lxc-devel mailing list<br>
<a href="mailto:Lxc-devel@lists.sourceforge.net">Lxc-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/lxc-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/lxc-devel</a><br>
</blockquote></div><br>