On Fri, Dec 06, 2013 at 03:36:44PM -0500, Dwight Engen wrote: > Adding the epoll events allows the handler to determine what events > happened on the fd. > > Signed-off-by: Dwight Engen <dwight.en...@oracle.com>
Acked-by: Stéphane Graber <stgra...@ubuntu.com> > --- > src/lxc/commands.c | 6 ++++-- > src/lxc/console.c | 8 ++++---- > src/lxc/lxc_monitord.c | 6 +++--- > src/lxc/lxcutmp.c | 7 ++++--- > src/lxc/mainloop.c | 4 ++-- > src/lxc/mainloop.h | 3 ++- > src/lxc/start.c | 2 +- > 7 files changed, 20 insertions(+), 16 deletions(-) > > diff --git a/src/lxc/commands.c b/src/lxc/commands.c > index 63adaf5..ae4ff1e 100644 > --- a/src/lxc/commands.c > +++ b/src/lxc/commands.c > @@ -752,7 +752,8 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler > *handler, > process_unlock(); > } > > -static int lxc_cmd_handler(int fd, void *data, struct lxc_epoll_descr *descr) > +static int lxc_cmd_handler(int fd, uint32_t events, void *data, > + struct lxc_epoll_descr *descr) > { > int ret; > struct lxc_cmd_req req; > @@ -816,7 +817,8 @@ out_close: > goto out; > } > > -static int lxc_cmd_accept(int fd, void *data, struct lxc_epoll_descr *descr) > +static int lxc_cmd_accept(int fd, uint32_t events, void *data, > + struct lxc_epoll_descr *descr) > { > int opt = 1, ret = -1, connection; > > diff --git a/src/lxc/console.c b/src/lxc/console.c > index d854dbb..5d91f24 100644 > --- a/src/lxc/console.c > +++ b/src/lxc/console.c > @@ -109,7 +109,7 @@ void lxc_console_sigwinch(int sig) > } > } > > -static int lxc_console_cb_sigwinch_fd(int fd, void *cbdata, > +static int lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata, > struct lxc_epoll_descr *descr) > { > struct signalfd_siginfo siginfo; > @@ -211,7 +211,7 @@ static void lxc_console_sigwinch_fini(struct > lxc_tty_state *ts) > free(ts); > } > > -static int lxc_console_cb_con(int fd, void *data, > +static int lxc_console_cb_con(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > struct lxc_console *console = (struct lxc_console *)data; > @@ -628,7 +628,7 @@ err: > > > > -static int lxc_console_cb_tty_stdin(int fd, void *cbdata, > +static int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata, > struct lxc_epoll_descr *descr) > { > struct lxc_tty_state *ts = cbdata; > @@ -658,7 +658,7 @@ static int lxc_console_cb_tty_stdin(int fd, void *cbdata, > return 0; > } > > -static int lxc_console_cb_tty_master(int fd, void *cbdata, > +static int lxc_console_cb_tty_master(int fd, uint32_t events, void *cbdata, > struct lxc_epoll_descr *descr) > { > struct lxc_tty_state *ts = cbdata; > diff --git a/src/lxc/lxc_monitord.c b/src/lxc/lxc_monitord.c > index 11936a9..381b2d6 100644 > --- a/src/lxc/lxc_monitord.c > +++ b/src/lxc/lxc_monitord.c > @@ -130,7 +130,7 @@ static void lxc_monitord_sockfd_remove(struct lxc_monitor > *mon, int fd) { > mon->clientfds_cnt--; > } > > -static int lxc_monitord_sock_handler(int fd, void *data, > +static int lxc_monitord_sock_handler(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > struct lxc_monitor *mon = data; > @@ -139,7 +139,7 @@ static int lxc_monitord_sock_handler(int fd, void *data, > return 0; > } > > -static int lxc_monitord_sock_accept(int fd, void *data, > +static int lxc_monitord_sock_accept(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > int ret,clientfd; > @@ -262,7 +262,7 @@ static void lxc_monitord_delete(struct lxc_monitor *mon) > mon->clientfds_cnt = 0; > } > > -static int lxc_monitord_fifo_handler(int fd, void *data, > +static int lxc_monitord_fifo_handler(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > int ret,i; > diff --git a/src/lxc/lxcutmp.c b/src/lxc/lxcutmp.c > index bfebe55..d4a180c 100644 > --- a/src/lxc/lxcutmp.c > +++ b/src/lxc/lxcutmp.c > @@ -134,14 +134,15 @@ typedef void (*lxc_mainloop_timer_t) (void *data); > > static int utmp_get_runlevel(struct lxc_utmp *utmp_data); > static int utmp_get_ntasks(struct lxc_handler *handler); > -static int utmp_shutdown_handler(int fd, void *data, > +static int utmp_shutdown_handler(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr); > static int lxc_utmp_add_timer(struct lxc_epoll_descr *descr, > lxc_mainloop_callback_t callback, void *data); > static int lxc_utmp_del_timer(struct lxc_epoll_descr *descr, > struct lxc_utmp *utmp_data); > > -static int utmp_handler(int fd, void *data, struct lxc_epoll_descr *descr) > +static int utmp_handler(int fd, uint32_t events, void *data, > + struct lxc_epoll_descr *descr) > { > struct inotify_event *ie; > int size, ret, length; > @@ -387,7 +388,7 @@ out: > return -1; > } > > -static int utmp_shutdown_handler(int fd, void *data, > +static int utmp_shutdown_handler(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > int ntasks; > diff --git a/src/lxc/mainloop.c b/src/lxc/mainloop.c > index 9ba98ee..ec0c252 100644 > --- a/src/lxc/mainloop.c > +++ b/src/lxc/mainloop.c > @@ -60,8 +60,8 @@ int lxc_mainloop(struct lxc_epoll_descr *descr, int > timeout_ms) > > /* If the handler returns a positive value, exit > the mainloop */ > - if (handler->callback(handler->fd, handler->data, > - descr) > 0) > + if (handler->callback(handler->fd, events[i].events, > + handler->data, descr) > 0) > return 0; > } > > diff --git a/src/lxc/mainloop.h b/src/lxc/mainloop.h > index 217a58f..21ef577 100644 > --- a/src/lxc/mainloop.h > +++ b/src/lxc/mainloop.h > @@ -24,6 +24,7 @@ > #ifndef _mainloop_h > #define _mainloop_h > > +#include <stdint.h> > #include "list.h" > > struct lxc_epoll_descr { > @@ -31,7 +32,7 @@ struct lxc_epoll_descr { > struct lxc_list handlers; > }; > > -typedef int (*lxc_mainloop_callback_t)(int fd, void *data, > +typedef int (*lxc_mainloop_callback_t)(int fd, uint32_t event, void *data, > struct lxc_epoll_descr *descr); > > extern int lxc_mainloop(struct lxc_epoll_descr *descr, int timeout_ms); > diff --git a/src/lxc/start.c b/src/lxc/start.c > index 05c3ab7..f49516a 100644 > --- a/src/lxc/start.c > +++ b/src/lxc/start.c > @@ -239,7 +239,7 @@ static int setup_signal_fd(sigset_t *oldmask) > return fd; > } > > -static int signal_handler(int fd, void *data, > +static int signal_handler(int fd, uint32_t events, void *data, > struct lxc_epoll_descr *descr) > { > struct signalfd_siginfo siginfo; > -- > 1.8.3.1 > > > ------------------------------------------------------------------------------ > Sponsored by Intel(R) XDK > Develop, test and display web and hybrid apps with a single code base. > Download it for free now! > http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk > _______________________________________________ > lxc-devel mailing list > lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________ lxc-devel mailing list lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel