blob: 1d8890adff6adcc10e7bdcefa524f9f5c7d7a16b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Stub dlfcn implementation for systems that lack shared library support
* but obviously can still reference compiled-in symbols.
*/
#ifndef NO_SHARED_LIBS
#include_next <dlfcn.h>
#else
#define RTLD_LAZY 0
#define RTLD_GLOBAL 1
#define _FAKE_DLFCN_HDL (void *)0xbeefcafe
static inline void *dlopen(const char *file, int flag)
{
if (file == NULL)
return _FAKE_DLFCN_HDL;
else
return NULL;
}
void *_dlsym(const char *sym);
static inline void *dlsym(void *handle, const char *sym)
{
if (handle != _FAKE_DLFCN_HDL)
return NULL;
return _dlsym(sym);
}
static inline char *dlerror(void)
{
return NULL;
}
static inline int dlclose(void *handle)
{
return (handle == _FAKE_DLFCN_HDL) ? 0 : 1;
}
#endif
|