• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "config.h"
17 #include <dlfcn.h>
18 #include <pulsecore/core-util.h>
19 
20 #include "ltdl.h"
21 
22 #if (defined(__aarch64__) || defined(__x86_64__))
23 #define SYSTEM_LIB_PATH "/system/lib64/"
24 #else
25 #define SYSTEM_LIB_PATH "/system/lib/"
26 #endif
27 
lt_dlopenext(const char * filename)28 lt_dlhandle lt_dlopenext(const char *filename)
29 {
30     pa_assert(filename);
31     return (dlopen(filename, RTLD_NOW));
32 }
33 
lt_dlsym(lt_dlhandle handle,const char * symbol)34 void *lt_dlsym(lt_dlhandle handle, const char *symbol)
35 {
36     pa_assert(handle);
37     pa_assert(symbol);
38 
39     return (dlsym(handle, symbol));
40 }
41 
lt_dlclose(lt_dlhandle handle)42 int lt_dlclose(lt_dlhandle handle)
43 {
44     pa_assert(handle);
45     return (dlclose(handle));
46 }
47 
lt_dlerror(void)48 const char *lt_dlerror(void)
49 {
50     return dlerror();
51 }
52 
lt_dlgetsearchpath(void)53 const char *lt_dlgetsearchpath(void)
54 {
55     const char *path = SYSTEM_LIB_PATH;
56     return path;
57 }
58