11 Star 76 Fork 100

OpenHarmony / third_party_lwip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0003-fix-the-occasional-coredump-when-the-lwip-exits.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
Aurora 提交于 2023-12-07 03:26 . update lwip to 2.1.3-39.oe2203sp1
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
1
https://gitee.com/openharmony/third_party_lwip.git
git@gitee.com:openharmony/third_party_lwip.git
openharmony
third_party_lwip
third_party_lwip
master

搜索帮助