From 85964a41fd991a40f28c770f542c15432eafb715 Mon Sep 17 00:00:00 2001 From: fadhil riyanto Date: Fri, 27 Sep 2024 20:10:50 +0700 Subject: add function that install fd into epoll instance Signed-off-by: fadhil riyanto --- main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 2a6738f..4c67f29 100644 --- a/main.c +++ b/main.c @@ -152,6 +152,14 @@ static void setup_epoll(struct server_ctx *srv_ctx) srv_ctx->epoll_fd = epoll_create1(EPOLL_CLOEXEC); } +static void install_fd2epoll(int intrest_fd, struct server_ctx *srv_ctx) +{ + epoll_ctl(srv_ctx->epoll_fd, EPOLL_CTL_ADD, intrest_fd, + srv_ctx->epoll_fd_queue[srv_ctx->epoll_fd_queue->i].eventmode); + + srv_ctx->epoll_fd_queue->i = srv_ctx->epoll_fd_queue->i + 1; +} + static int enter_eventloop(struct server_ctx *srv_ctx) { setup_epoll(srv_ctx); -- cgit v1.2.3