1 Star 0 Fork 48

修一/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0003-fix-the-occasional-coredump-when-the-lwip-exits.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2021-12-31 16:07 . adapt to lstack
From 0d5070b4a40912a7921e0101461a9c7d61919acd Mon Sep 17 00:00:00 2001
From: HuangLiming <huangliming5@huawei.com>
Date: Tue, 25 May 2021 03:08:33 -0400
Subject: [PATCH] fix the occasional coredump when the lwip exits
Signed-off-by: HuangLiming <huangliming5@huawei.com>
---
src/api/sockets.c | 37 +++++++++----------------------------
1 file changed, 9 insertions(+), 28 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index d62e55b..658f762 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4655,36 +4655,17 @@ void lwip_sock_init(void)
return;
}
-//modify from lwip_close
void lwip_exit(void)
{
- int i, is_tcp;
- struct lwip_sock *sock;
-
- if (memp_pools[MEMP_SYS_MBOX] == NULL) {
- return;
- }
-
- for (i = 0; i < sockets_num; i++) {
- sock = &sockets[i];
- if (!sock->conn)
- continue;
-#if LWIP_IGMP
- /* drop all possibly joined IGMP memberships */
- lwip_socket_drop_registered_memberships(i);
-#endif /* LWIP_IGMP */
- /*
- * process is exiting, call netconn_delete to
- * close tcp connection, and ignore the return value
- */
- is_tcp = NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP;
- netconn_delete(sock->conn);
- free_socket(sock, is_tcp);
- }
-
- free(sockets);
- sockets = NULL;
- sockets_num = 0;
+ /*
+ * LwIP has the following two parts of memory application, but
+ * it is unnecessary to release all memory in sequentially,
+ * which increases complexity. Therefore, we rely on the process
+ * reclamation mechanism of the system to release memory.
+ * 1. a sockets table of the process.
+ * 2. a batch of hugepage memory of each thread.
+ */
+ return;
}
#endif /* USE_LIBOS */
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/slxiu/lwip.git
git@gitee.com:slxiu/lwip.git
slxiu
lwip
lwip
master

搜索帮助