~serge-hallyn/ubuntu/natty/lxc/lxc-fix-3bugs

« back to all changes in this revision

Viewing changes to src/lxc/mainloop.c

  • Committer: Bazaar Package Importer
  • Author(s): Guido Trotter, Stéphane Graber, Guido Trotter
  • Date: 2010-01-10 10:40:21 UTC
  • mfrom: (1.1.2 upstream) (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100110104021-z8rj5zw5mlvra08l
Tags: 0.6.4-1
[ Stéphane Graber ]
* Upgrade standards-version to 3.8.3
* Drop the copy of etc/* from rules as "etc" is no longer in the tarball

[ Guido Trotter ]
* New Upstream Version
* Update libcap2-dev dependency to libcap-dev
* Install upstream-built man pages via debian/lxc.manpages
* Drop unneeded docbook-utils build dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include "mainloop.h"
31
31
 
32
 
struct lxc_handler {
 
32
struct mainloop_handler {
33
33
        lxc_mainloop_callback_t callback;
34
34
        int fd;
35
35
        void *data;
38
38
int lxc_mainloop(struct lxc_epoll_descr *descr)
39
39
{
40
40
        int i, nfds, triggered;
41
 
        struct lxc_handler *handler;
 
41
        struct mainloop_handler *handler;
42
42
 
43
43
        for (;;) {
44
44
 
58
58
                                continue;
59
59
 
60
60
                        triggered++;
61
 
                        handler = (struct lxc_handler *)descr->ev[i].data.ptr;
 
61
                        handler =
 
62
                          (struct mainloop_handler *) descr->ev[i].data.ptr;
62
63
 
63
64
                        /* If the handler returns a positive value, exit
64
65
                           the mainloop */
79
80
                             lxc_mainloop_callback_t callback, void *data)
80
81
{
81
82
        struct epoll_event *ev;
82
 
        struct lxc_handler *handler;
 
83
        struct mainloop_handler *handler;
83
84
        int ret = -1;
84
85
 
85
86
        handler = malloc(sizeof(*handler));
118
119
int lxc_mainloop_del_handler(struct lxc_epoll_descr *descr, int fd)
119
120
{
120
121
        struct epoll_event *ev;
121
 
        struct lxc_handler *handler;
 
122
        struct mainloop_handler *handler;
122
123
        int i, j, idx = 0;
123
124
 
124
125
        for (i = 0; i < descr->nfds; i++) {
153
154
        return -1;
154
155
}
155
156
 
156
 
int lxc_mainloop_open(int size, struct lxc_epoll_descr *descr)
 
157
int lxc_mainloop_open(struct lxc_epoll_descr *descr)
157
158
{
158
159
        descr->nfds = 0;
159
160
        descr->ev = NULL;
160
161
 
161
 
        descr->epfd = epoll_create(size);
 
162
        /* hint value passed to epoll create */
 
163
        descr->epfd = epoll_create(2);
162
164
        if (descr->epfd < 0)
163
165
                return -1;
164
166