This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | dl_restrict |
| #define | RTLD_DEFAULT ((void *) -2) |
| #define | RTLD_GLOBAL 0x8 |
| #define | RTLD_LAZY 0x1 |
| #define | RTLD_LOCAL 0x4 |
| #define | RTLD_NEXT ((void *) -1) |
| #define | RTLD_NODELETE 0x80 |
| #define | RTLD_NOLOAD 0x10 |
| #define | RTLD_NOW 0x2 |
Typedefs | |
| typedef dl_info | Dl_info |
Functions | |
| int | dladdr (const void *dl_restrict, Dl_info *dl_restrict) |
| int | dlclose (void *handle) |
| const char * | dlerror (void) |
| void * | dlopen (const char *path, int mode) |
| void * | dlsym (void *dl_restrict handle, const char *dl_restrict symbol) |
|
|
Definition at line 52 of file dlfcn-compat.h. |
|
|
Definition at line 82 of file dlfcn-compat.h. Referenced by dlsymIntern(). |
|
|
Definition at line 74 of file dlfcn-compat.h. Referenced by __load_resource(), loadModule(), and reference(). |
|
|
Definition at line 71 of file dlfcn-compat.h. Referenced by __load_resource(), and dlopen(). |
|
|
Definition at line 73 of file dlfcn-compat.h. |
|
|
Definition at line 81 of file dlfcn-compat.h. Referenced by dlsymIntern(). |
|
|
Definition at line 76 of file dlfcn-compat.h. Referenced by dlclose(). |
|
|
Definition at line 75 of file dlfcn-compat.h. Referenced by dlopen(). |
|
|
Definition at line 72 of file dlfcn-compat.h. |
|
|
|
|
||||||||||||
|
|
|
|
Definition at line 1041 of file dlfcn.c. References debug, dlsymIntern(), dolock(), dounlock(), error(), get_lib_name(), get_mach_header_from_NSModule(), isFlagSet(), isValidStatus(), dlstatus::lib, MAGIC_DYLIB_MOD, dlstatus::mode, dlstatus::module, name, dlstatus::refs, resetdlerror(), RTLD_NODELETE, and warning(). Referenced by __load_resource(), and ast_unload_resource(). 01042 {
01043 struct dlstatus *dls = handle;
01044 dolock();
01045 resetdlerror();
01046 if (!isValidStatus(dls))
01047 {
01048 goto dlcloseerror;
01049 }
01050 if (dls->module == MAGIC_DYLIB_MOD)
01051 {
01052 const char *name;
01053 if (!dls->lib)
01054 {
01055 name = "global context";
01056 }
01057 else
01058 {
01059 name = get_lib_name(dls->lib);
01060 }
01061 warning("trying to close a .dylib!");
01062 error("Not closing \"%s\" - dynamic libraries cannot be closed", name);
01063 goto dlcloseerror;
01064 }
01065 if (!dls->module)
01066 {
01067 error("module already closed");
01068 goto dlcloseerror;
01069 }
01070
01071 if (dls->refs == 1)
01072 {
01073 unsigned long options = 0;
01074 void (*fini) (void);
01075 if ((fini = dlsymIntern(dls, "__fini", 0)))
01076 {
01077 debug("calling _fini()");
01078 fini();
01079 }
01080 #ifdef __ppc__
01081 options |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
01082 #endif
01083 #if 1
01084 /* Currently, if a module contains c++ static destructors and it is unloaded, we
01085 * get a segfault in atexit(), due to compiler and dynamic loader differences of
01086 * opinion, this works around that.
01087 * I really need a way to figure out from code if this is still necessary.
01088 */
01089 if ((const struct section *)NULL !=
01090 getsectbynamefromheader(get_mach_header_from_NSModule(dls->module),
01091 "__DATA", "__mod_term_func"))
01092 {
01093 options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
01094 }
01095 #endif
01096 #ifdef RTLD_NODELETE
01097 if (isFlagSet(dls->mode, RTLD_NODELETE))
01098 options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
01099 #endif
01100 if (!NSUnLinkModule(dls->module, options))
01101 {
01102 error("unable to unlink module");
01103 goto dlcloseerror;
01104 }
01105 dls->refs--;
01106 dls->module = 0;
01107 /* Note: the dlstatus struct dls is neither removed from the list
01108 * nor is the memory it occupies freed. This shouldn't pose a
01109 * problem in mostly all cases, though.
01110 */
01111 }
01112 dounlock();
01113 return 0;
01114 dlcloseerror:
01115 dounlock();
01116 return 1;
01117 }
|
|
|
Definition at line 1119 of file dlfcn.c. References dlerror_key, dlthread::errset, and dlthread::errstr. Referenced by __load_resource(). 01120 {
01121 struct dlthread *tss;
01122 char * err_str;
01123 tss = pthread_getspecific(dlerror_key);
01124 err_str = tss->errstr;
01125 tss = pthread_getspecific(dlerror_key);
01126 if (tss->errset == 0)
01127 return 0;
01128 tss->errset = 0;
01129 return (err_str );
01130 }
|
|
||||||||||||
|
Definition at line 897 of file dlfcn.c. References dlcompat_init_func(), dolock(), dounlock(), error(), findFile(), isFlagSet(), loadModule(), lookupStatus(), reference(), dlstatus::refs, resetdlerror(), RTLD_LAZY, RTLD_NOLOAD, and RTLD_NOW. Referenced by __load_resource(). 00898 {
00899 const struct stat *sbuf;
00900 struct dlstatus *dls;
00901 const char *fullPath;
00902 dlcompat_init_func(); /* Just in case */
00903 dolock();
00904 resetdlerror();
00905 if (!path)
00906 {
00907 dls = &mainStatus;
00908 goto dlopenok;
00909 }
00910 if (!(sbuf = findFile(path, &fullPath)))
00911 {
00912 error("file \"%s\" not found", path);
00913 goto dlopenerror;
00914 }
00915 /* Now checks that it hasn't been closed already */
00916 if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
00917 {
00918 /* debug("status found"); */
00919 dls = reference(dls, mode);
00920 goto dlopenok;
00921 }
00922 #ifdef RTLD_NOLOAD
00923 if (isFlagSet(mode, RTLD_NOLOAD))
00924 {
00925 error("no existing handle and RTLD_NOLOAD specified");
00926 goto dlopenerror;
00927 }
00928 #endif
00929 if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
00930 {
00931 error("how can I load something both RTLD_LAZY and RTLD_NOW?");
00932 goto dlopenerror;
00933 }
00934 dls = loadModule(fullPath, sbuf, mode);
00935
00936 dlopenok:
00937 dounlock();
00938 return (void *)dls;
00939 dlopenerror:
00940 dounlock();
00941 return NULL;
00942 }
|
|
||||||||||||
|
Definition at line 945 of file dlfcn.c. References dlsymIntern(), dolock(), dounlock(), error(), free, and malloc. Referenced by __load_resource(). 00946 {
00947 int sym_len = strlen(symbol);
00948 void *value = NULL;
00949 char *malloc_sym = NULL;
00950 dolock();
00951 malloc_sym = malloc(sym_len + 2);
00952 if (malloc_sym)
00953 {
00954 sprintf(malloc_sym, "_%s", symbol);
00955 value = dlsymIntern(handle, malloc_sym, 1);
00956 free(malloc_sym);
00957 }
00958 else
00959 {
00960 error("Unable to allocate memory");
00961 goto dlsymerror;
00962 }
00963 dounlock();
00964 return value;
00965 dlsymerror:
00966 dounlock();
00967 return NULL;
00968 }
|
1.4.2