1 #ifndef _DLFCN_H
2 #include <dl/dlfcn.h>
3 
4 #define internal_function
5 
6 /* Internally used flag.  */
7 #define __RTLD_DLOPEN	0x80000000
8 #define __RTLD_SPROF	0x40000000
9 
10 /* Now define the internal interfaces.  */
11 extern void *__dlvsym (void *__handle, __const char *__name,
12 		       __const char *__version);
13 
14 extern void *__libc_dlopen  (__const char *__name);
15 extern void *__libc_dlsym   (void *__map, __const char *__name);
16 extern int   __libc_dlclose (void *__map);
17 
18 /* Locate shared object containing the given address.  */
19 extern int _dl_addr (const void *address, Dl_info *info)
20      internal_function;
21 
22 /* Open the shared object NAME, relocate it, and run its initializer if it
23    hasn't already been run.  MODE is as for `dlopen' (see <dlfcn.h>).  If
24    the object is already opened, returns its existing map.  */
25 extern void *_dl_open (const char *name, int mode, const void *caller)
26      internal_function;
27 
28 /* Close an object previously opened by _dl_open.  */
29 extern void _dl_close (void *map)
30      internal_function;
31 
32 /* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or
33    RTLD_NEXT).  WHO is the calling function, for RTLD_NEXT.  Returns
34    the symbol value, which may be NULL.  */
35 extern void *_dl_sym (void *handle, const char *name, void *who)
36     internal_function;
37 
38 /* Look up version VERSION of symbol NAME in shared object HANDLE
39    (which may be RTLD_DEFAULT or RTLD_NEXT).  WHO is the calling
40    function, for RTLD_NEXT.  Returns the symbol value, which may be
41    NULL.  */
42 extern void *_dl_vsym (void *handle, const char *name, const char *version,
43 		       void *who)
44     internal_function;
45 
46 /* Call OPERATE, catching errors from `dl_signal_error'.  If there is no
47    error, *ERRSTRING is set to null.  If there is an error, *ERRSTRING is
48    set to a string constructed from the strings passed to _dl_signal_error,
49    and the error code passed is the return value and *OBJNAME is set to
50    the object name which experienced the problems.  ERRSTRING if nonzero
51    points to a malloc'ed string which the caller has to free after use.
52    ARGS is passed as argument to OPERATE.  */
53 extern int _dl_catch_error (const char **objname, const char **errstring,
54 			    void (*operate) (void *),
55 			    void *args)
56      internal_function;
57 
58 /* Helper function for <dlfcn.h> functions.  Runs the OPERATE function via
59    _dl_catch_error.  Returns zero for success, nonzero for failure; and
60    arranges for `dlerror' to return the error details.
61    ARGS is passed as argument to OPERATE.  */
62 extern int _dlerror_run (void (*operate) (void *), void *args)
63      internal_function;
64 
65 #endif
66