File: dlfcn.d

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (211 lines) | stat: -rw-r--r-- 5,377 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/**
 * D header file for GNU/Linux
 *
 * $(LINK2 http://sourceware.org/git/?p=glibc.git;a=blob;f=dlfcn/dlfcn.h, glibc dlfcn/dlfcn.h)
 */
module core.sys.linux.dlfcn;

version (linux):
extern (C):
nothrow:
@nogc:
@system:

version (ARM)     version = ARM_Any;
version (AArch64) version = ARM_Any;
version (HPPA)    version = HPPA_Any;
version (MIPS32)  version = MIPS_Any;
version (MIPS64)  version = MIPS_Any;
version (PPC)     version = PPC_Any;
version (PPC64)   version = PPC_Any;
version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any;
version (S390)    version = IBMZ_Any;
version (SPARC)   version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (X86)     version = X86_Any;
version (X86_64)  version = X86_Any;

public import core.sys.posix.dlfcn;
import core.sys.linux.config;

// <bits/dlfcn.h>
version (X86_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (HPPA_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/hppa/bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (MIPS_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (PPC_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (ARM_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (RISCV_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (SPARC_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else version (IBMZ_Any)
{
    // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
    static if (_GNU_SOURCE)
    {
        RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
        {
            _dl_mcount_wrapper_check(cast(void*)fctp);
            return fctp(args);
        }

        void _dl_mcount_wrapper_check(void* __selfpc);
    }
}
else
    static assert(0, "unimplemented");

// <bits/dlfcn.h>

static if (_GNU_SOURCE)
{
    enum RTLD_NEXT = cast(void *)-1L;
    enum RTLD_DEFAULT = cast(void *)0;
    alias c_long Lmid_t;
    enum LM_ID_BASE = 0;
    enum LM_ID_NEWLM = -1;
}

// void* dlopen(const scope char* __file, int __mode); // POSIX
// int dlclose(void* __handle); // POSIX
// void* dlsym(void* __handle, const scope char* __name); // POSIX

static if (_GNU_SOURCE)
{
    void* dlmopen(Lmid_t __nsid, const scope char* __file, int __mode);
    void* dlvsym(void* __handle, const scope char* __name, const scope char* __version);
}

// char* dlerror(); // POSIX

static if (_GNU_SOURCE)
{
    int dladdr1(void* __address, Dl_info* __info, void** __extra_info, int __flags);

    enum
    {
        RTLD_DL_SYMENT = 1,
        RTLD_DL_LINKMAP = 2,
    }

    int dlinfo(void* __handle, int __request, void* __arg);

    enum
    {
        RTLD_DI_LMID = 1,
        RTLD_DI_LINKMAP = 2,
        RTLD_DI_CONFIGADDR = 3,
        RTLD_DI_SERINFO = 4,
        RTLD_DI_SERINFOSIZE = 5,
        RTLD_DI_ORIGIN = 6,
        RTLD_DI_PROFILENAME = 7,
        RTLD_DI_PROFILEOUT = 8,
        RTLD_DI_TLS_MODID = 9,
        RTLD_DI_TLS_DATA = 10,
        RTLD_DI_MAX = 10,
    }

    struct Dl_serpath
    {
        char* dls_name;
        uint dls_flags;
    }

    struct Dl_serinfo
    {
        size_t dls_size;
        uint dls_cnt;
        Dl_serpath[1] dls_serpath;
    }
}