summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfadhil riyanto <me@fadev.org>2024-09-27 20:10:50 +0700
committerfadhil riyanto <me@fadev.org>2024-09-27 20:10:50 +0700
commit85964a41fd991a40f28c770f542c15432eafb715 (patch)
treecbecb1d39968db96d071146c73015da96911fd34
parent369b6484db835bf42f84b469a9c03631cfc06c4d (diff)
add function that install fd into epoll instance
Signed-off-by: fadhil riyanto <me@fadev.org>
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
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);