• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * @defgroup dlfcn Dlfcn
3  * @ingroup libc
4  */
5 
6 #ifndef	_DLFCN_H
7 #define	_DLFCN_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include <features.h>
14 
15 #define RTLD_LAZY   1
16 #define RTLD_NOW    2
17 #define RTLD_NOLOAD 4
18 #define RTLD_NODELETE 4096
19 #define RTLD_GLOBAL 256
20 #define RTLD_LOCAL  0
21 
22 #define RTLD_NEXT    ((void *)-1)
23 #define RTLD_DEFAULT ((void *)0)
24 
25 #define RTLD_DI_LINKMAP 2
26 
27 
28 /**
29  * @ingroup dlfcn
30  *
31  * @par Description:
32  * The function shall close the loading shared libraries.
33  *
34  * @attention
35  * <ul>
36  * <li>None.</li>
37  * </ul>
38  *
39  * @retval #int On success, this function shall return LOS_OK.
40  * On failure, this function shall return LOS_NOK or -1.
41  *
42  * @par Dependency:
43  * <ul><li>dlfcn.h</li></ul>
44  *
45  * @see dlopen | dlsym
46  *
47  */
48 int    dlclose(void *);
49 char  *dlerror(void);
50 
51 /**
52  * @ingroup dlfcn
53  *
54  * @par Description:
55  * The function shall return the pointer to the handle of loading shared libraries.
56  *
57  * @attention
58  * <ul>
59  * <li>The function is not supported for the second param.</li>
60  * </ul>
61  *
62  * @retval #void* On success, this function shall return the pointer to the handle of
63  *  loading shared libraries. On failure, this function shall return NULL.
64  *
65  * @par Dependency:
66  * <ul><li>dlfcn.h</li></ul>
67  *
68  * @see dlclose | dlsym
69  *
70  */
71 void  *dlopen(const char *, int);
72 
73 /**
74  * @ingroup dlfcn
75  *
76  * @par Description:
77  * The function shall return the second param address in memory of loading shared libraries.
78  *
79  * @attention
80  * <ul>
81  * <li>None.</li>
82  * </ul>
83  *
84  * @retval #void*  On success, this function shall return the second param address in memory
85  *  of loading shared libraries. On failure, this function shall return NULL.
86  *
87  * @par Dependency:
88  * <ul><li>dlfcn.h</li></ul>
89  *
90  * @see dlopen | dlclose
91  *
92  */
93 void  *dlsym(void *__restrict, const char *__restrict);
94 
95 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
96 typedef struct {
97 	const char *dli_fname;
98 	void *dli_fbase;
99 	const char *dli_sname;
100 	void *dli_saddr;
101 } Dl_info;
102 int dladdr(const void *, Dl_info *);
103 int dlinfo(void *, int, void *);
104 #endif
105 
106 #if _REDIR_TIME64
107 __REDIR(dlsym, __dlsym_time64);
108 #endif
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif
115