• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 970d9d6fd15c433af20bbbd7418c5e9773d58471 Mon Sep 17 00:00:00 2001
2From: jiangheng <jiangheng12@huawei.com>
3Date: Mon, 7 Mar 2022 21:08:13 +0800
4Subject: [PATCH] remove chose_dlsym_handle function, set handle to RTLD_NEXT
5
6---
7 src/api/posix_api.c | 33 +--------------------------------
8 1 file changed, 1 insertion(+), 32 deletions(-)
9
10diff --git a/src/api/posix_api.c b/src/api/posix_api.c
11index eff9f46..bce07f5 100644
12--- a/src/api/posix_api.c
13+++ b/src/api/posix_api.c
14@@ -64,33 +64,6 @@ void posix_api_fork(void)
15     posix_api->get_socket = chld_get_socket;
16 }
17
18-static int chose_dlsym_handle(void *__restrict* khandle)
19-{
20-    void *dlhandle;
21-    int (*gazelle_epoll_create)(int size);
22-    dlhandle = dlopen ("liblstack.so", RTLD_LAZY);
23-    if (dlhandle == NULL) {
24-        return ERR_IF;
25-    }
26-
27-    gazelle_epoll_create = dlsym(dlhandle, "epoll_create");
28-    if (gazelle_epoll_create == NULL) {
29-        return ERR_MEM;
30-    }
31-
32-    dlclose(dlhandle);
33-
34-    *khandle = RTLD_NEXT;
35-    if (dlsym(*khandle, "epoll_create") == gazelle_epoll_create) {
36-        RTE_LOG(ERR, EAL, "posix api use RTLD_DEFAULT\n");
37-        *khandle = RTLD_DEFAULT;
38-    } else {
39-        RTE_LOG(ERR, EAL, "posix api use RTLD_NEXT\n");
40-    }
41-
42-    return ERR_OK;
43-}
44-
45 int posix_api_init(void)
46 {
47 /* the symbol we use here won't be NULL, so we don't need dlerror()
48@@ -102,11 +75,7 @@ int posix_api_init(void)
49
50     posix_api = &posix_api_val;
51
52-    void *__restrict handle;
53-    int ret = chose_dlsym_handle(&handle);
54-    if (ret != ERR_OK) {
55-        return ret;
56-    }
57+    void *__restrict handle = RTLD_NEXT;
58
59     /* glibc standard api */
60     CHECK_DLSYM_RET_RETURN(posix_api->socket_fn = dlsym(handle, "socket"));
61--
621.8.3.1
63
64