]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
remove dead code in monitor.c
authorMichel Normand <normand@fr.ibm.com>
Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)
This code is not used in lxc.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc.h
src/lxc/monitor.c

index f7ae8651948a73fe0c79c355ae51e21d542df564..89572f2c66a26876b0dd162a62ea7de6e09c7671 100644 (file)
@@ -82,17 +82,6 @@ extern int lxc_start(const char *name, char *const argv[]);
  */
 extern int lxc_stop(const char *name);
 
-/*
- * Monitor the container, each time the state of the container
- * is changed, a state data is send through a file descriptor passed to
- * the function with output_fd.
- * The function will block until the container is destroyed.
- * @name : the name of the container
- * @output_fd : the file descriptor where to send the states
- * Returns 0 on success, < 0 otherwise
- */
-extern int lxc_monitor(const char *name, int output_fd);
-
 /*
  * Open the monitoring mechanism for a specific container
  * The function will return an fd corresponding to the events
index 17d0a8e5e400b5e8b3764ab0222b70236c4a1bf2..700f5bc3dea9422d60a470d7c083717fef07ad04 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
-#include <sys/inotify.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
@@ -46,66 +45,6 @@ lxc_log_define(lxc_monitor, lxc);
 #define UNIX_PATH_MAX 108
 #endif
 
-int lxc_monitor(const char *name, int output_fd)
-{
-       char path[MAXPATHLEN];
-       int err = -1, nfd, wfd, state;
-
-       nfd = inotify_init();
-       if (nfd < 0) {
-               SYSERROR("failed to initialize inotify");
-               return -1;
-       }
-
-       snprintf(path, MAXPATHLEN, LXCPATH "/%s/state", name);
-
-       wfd = inotify_add_watch(nfd, path, IN_DELETE_SELF|IN_CLOSE_WRITE);
-       if (wfd < 0) {
-               SYSERROR("failed to add a watch on %s", path);
-               goto out;
-       }
-
-       for(;;) {
-               struct inotify_event evt;
-
-               if (read(nfd, &evt, sizeof(evt)) < 0) {
-                       SYSERROR("failed to read inotify event");
-                       goto out;
-               }
-
-               if (evt.mask & IN_CLOSE_WRITE) {
-
-                       state = lxc_getstate(name);
-                       if (state < 0) {
-                               ERROR("failed to get the state for %s",
-                                             name);
-                               goto out;
-                       }
-
-                       if (write(output_fd, &state, sizeof(state)) < 0) {
-                               SYSERROR("failed to send state to %d",
-                                                output_fd);
-                               goto out;
-                       }
-                       continue;
-               }
-
-               if (evt.mask & IN_DELETE_SELF) {
-                       close(output_fd);
-                       err = 0;
-                       goto out;
-               }
-
-               ERROR("unknown evt for inotity (%d)", evt.mask);
-               goto out;
-       }
-
-out:
-       inotify_rm_watch(nfd, wfd);
-       close(nfd);
-       return err;
-}
-
 static void lxc_monitor_send(struct lxc_msg *msg)
 {
        int fd;
@@ -162,7 +101,7 @@ int lxc_monitor_read(int fd, struct lxc_msg *msg)
        socklen_t len = sizeof(from);
        int ret;
 
-       ret = recvfrom(fd, msg, sizeof(*msg), 0, 
+       ret = recvfrom(fd, msg, sizeof(*msg), 0,
                       (struct sockaddr *)&from, &len);
        if (ret < 0) {
                SYSERROR("failed to receive state");