From 722edb36cd149eba7e30fcb78090f403173e6a34 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 4 Feb 2020 15:37:19 +0000 Subject: [PATCH] simplified mux in mod-sys.c a bit --- hawk/lib/mod-sys.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/hawk/lib/mod-sys.c b/hawk/lib/mod-sys.c index 527880e7..ea0afa17 100644 --- a/hawk/lib/mod-sys.c +++ b/hawk/lib/mod-sys.c @@ -126,15 +126,6 @@ struct sys_node_data_file_t }; typedef struct sys_node_data_file_t sys_node_data_file_t; -struct sys_node_data_sck_t -{ - int fd; - void* mux; /* if SYS_NODE_DATA_FLAG_IN_MUX is set, this is set to a valid pointer. it is of the void* type since sys_node_t is not available yet. */ - void* x_prev; - void* x_next; -}; -typedef struct sys_node_data_sck_t sys_node_data_sck_t; - struct sys_node_data_mux_t { #if defined(USE_EPOLL) @@ -152,7 +143,6 @@ struct sys_node_data_t union { sys_node_data_file_t file; - sys_node_data_sck_t sck; hawk_dir_t* dir; sys_node_data_mux_t mux; } u; @@ -322,6 +312,7 @@ static void del_from_mux (hawk_rtx_t* rtx, sys_node_t* fd_node) switch (fd_node->ctx.type) { case SYS_NODE_DATA_TYPE_FILE: + case SYS_NODE_DATA_TYPE_SCK: mux_node = (sys_node_t*)fd_node->ctx.u.file.mux; #if defined(USE_EPOLL) epoll_ctl (mux_node->ctx.u.mux.fd, EPOLL_CTL_DEL, fd_node->ctx.u.file.fd, &ev); @@ -329,14 +320,6 @@ static void del_from_mux (hawk_rtx_t* rtx, sys_node_t* fd_node) unchain_sys_node_from_mux_node (mux_node, fd_node); break; - case SYS_NODE_DATA_TYPE_SCK: - mux_node = (sys_node_t*)fd_node->ctx.u.sck.mux; - #if defined(USE_EPOLL) - epoll_ctl (mux_node->ctx.u.mux.fd, EPOLL_CTL_DEL, fd_node->ctx.u.sck.fd, &ev); - #endif - unchain_sys_node_from_mux_node (mux_node, fd_node); - break; - default: /* do nothing */ fd_node->ctx.flags &= ~SYS_NODE_DATA_FLAG_IN_MUX; @@ -358,6 +341,7 @@ static void free_sys_node (hawk_rtx_t* rtx, sys_list_t* list, sys_node_t* node) switch (node->ctx.type) { case SYS_NODE_DATA_TYPE_FILE: + case SYS_NODE_DATA_TYPE_SCK: if (node->ctx.u.file.fd >= 0) { del_from_mux (rtx, node); @@ -366,15 +350,6 @@ static void free_sys_node (hawk_rtx_t* rtx, sys_list_t* list, sys_node_t* node) } break; - case SYS_NODE_DATA_TYPE_SCK: - if (node->ctx.u.sck.fd >= 0) - { - del_from_mux (rtx, node); - close (node->ctx.u.sck.fd); - node->ctx.u.sck.fd = -1; - } - break; - case SYS_NODE_DATA_TYPE_DIR: if (node->ctx.u.dir) {