]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/mainloop.h
confile: cleanup parse_line()
[mirror_lxc.git] / src / lxc / mainloop.h
CommitLineData
cc73685d 1/* SPDX-License-Identifier: LGPL-2.1+ */
b0a33c1e 2
f1a4a029
ÇO
3#ifndef __LXC_MAINLOOP_H
4#define __LXC_MAINLOOP_H
e51d4895 5
84c92abd 6#include <stdint.h>
d38dd64a 7
d50aa57f 8#include "compiler.h"
f549edcc 9#include "list.h"
eafc1bb6 10#include "memory_utils.h"
b0a33c1e 11
49379222 12#define LXC_MAINLOOP_ERROR -1
a529bc25
CB
13#define LXC_MAINLOOP_CONTINUE 0
14#define LXC_MAINLOOP_CLOSE 1
15
b0a33c1e 16struct lxc_epoll_descr {
17 int epfd;
d066f3b8 18 struct lxc_list handlers;
b0a33c1e 19};
20
84c92abd 21typedef int (*lxc_mainloop_callback_t)(int fd, uint32_t event, void *data,
b0a33c1e 22 struct lxc_epoll_descr *descr);
23
d50aa57f 24__hidden extern int lxc_mainloop(struct lxc_epoll_descr *descr, int timeout_ms);
b0a33c1e 25
d50aa57f
CB
26__hidden extern int lxc_mainloop_add_handler_events(struct lxc_epoll_descr *descr, int fd, int events,
27 lxc_mainloop_callback_t callback, void *data);
28__hidden extern int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
29 lxc_mainloop_callback_t callback, void *data);
b0a33c1e 30
d50aa57f 31__hidden extern int lxc_mainloop_del_handler(struct lxc_epoll_descr *descr, int fd);
b0a33c1e 32
d50aa57f 33__hidden extern int lxc_mainloop_open(struct lxc_epoll_descr *descr);
b0a33c1e 34
d50aa57f 35__hidden extern void lxc_mainloop_close(struct lxc_epoll_descr *descr);
e51d4895 36
eafc1bb6 37define_cleanup_function(struct lxc_epoll_descr *, lxc_mainloop_close);
018051e3 38
e51d4895 39#endif