1. 24 Feb, 2010 8 commits
  2. 22 Jan, 2010 4 commits
  3. 21 Jan, 2010 7 commits
  4. 20 Jan, 2010 7 commits
  5. 18 Jan, 2010 4 commits
  6. 14 Jan, 2010 5 commits
  7. 13 Jan, 2010 5 commits
    • remove unused variable · 222dcd54
      Daniel Lezcano authored
      Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
    • export lxc_config_readline() · af5b0155
      Cedric Le Goater authored
      lxc_config_readline() will be used to parse configuration variable
      assigned from the command line with --define
      Signed-off-by: 's avatarCedric Le Goater <clg@fr.ibm.com>
      Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
    • Simplify mainloop · d066f3b8
      Clement Calmels authored
      Just use a list instead of array for dynamically allocated stuff. It's
      more appropriated.
      Signed-off-by: 's avatarClement Calmels <clement.calmels@fr.ibm.com>
      Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
    • Don't mess descr->ev · 5df6b18f
      Clement Calmels authored
      A simple test program to show up the issue:
      
      -8<---
      #include <stdio.h>
      #include <unistd.h>
      
      #include "mainloop.h"
      
      struct lxc_epoll_descr loop;
      
      int cb1(int fd, void *data, struct lxc_epoll_descr *descr)
      {
      	fprintf(stderr, "cb1\n");
              return 1;
      }
      
      int cb2(int fd, void *data, struct lxc_epoll_descr *descr)
      {
      	fprintf(stderr, "cb2\n");
              return 1;
      }
      
      int main(int argc, char *argv[])
      {
              int ret;
              int fds[2];
      
              ret = pipe(fds);
              if (ret) {
                      perror("pipe:");
                      return -1;
              }
      
              ret = lxc_mainloop_open(&loop);
              if (ret) {
                      fprintf(stderr, "lxc_mainloop_open: %d\n", ret);
                      return -1;
              }
      
              ret = lxc_mainloop_add_handler(&loop, fds[1], cb1, NULL);
              if (ret) {
                      fprintf(stderr, "lxc_mainloop_add_handler(fds[1]): %d\n", ret);
                      return -1;
              }
      
              ret = lxc_mainloop_add_handler(&loop, fds[0], cb2, NULL);
              if (ret) {
                      fprintf(stderr, "lxc_mainloop_add_handler(fds[0]): %d\n", ret);
                      return -1;
              }
      
              write(fds[1], &ret, sizeof(ret));
      
              ret = lxc_mainloop(&loop);
              if (ret) {
      	        fprintf(stderr, "lxc_mainloop: %d\n", ret);
      				return -1;
              }
      
              ret = lxc_mainloop_close(&loop);
              if (ret) {
                      fprintf(stderr, "lxc_mainloop_close: %d\n", ret);
                      return -1;
              }
      
              return 0;
      }
      
      Compile and run:
      $ gcc test.c -o test -I ./src/lxc/ ./src/lxc/liblxc_so-mainloop.o && ./test
      cb2
    • If epoll_ctl fails, the descr->ev array isinconsistent · 3ce45e64
      Clement Calmels authored
      Let's take an example:
      
      fd = open(..) /* fd = 3 for example */
      
      lxc_mainloop_add_handler(descr, fd, cb1, data1) fails.
      
      the program take care of the error, it closes the fd
      
      Later, reopen a fd (get 3 for again)
      
      lxc_mainloop_add_handler(desc, fd, cb2, data2) is ok.
      
      When something happen on fd, cb1 with data1 will be called instead of
      cb2 with data2, because descr->ev contains 2 entries for fd == 3.
      Signed-off-by: 's avatarClement Calmels <clement.calmels@fr.ibm.com>
      Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>