2175 |
2175 |
2176 #ifndef SERVICES_KERNEL |
2176 #ifndef SERVICES_KERNEL |
2177 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { |
2177 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { |
2178 char ebuf[1024]; |
2178 char ebuf[1024]; |
2179 char buffer[JVM_MAXPATHLEN]; |
2179 char buffer[JVM_MAXPATHLEN]; |
2180 void* library; |
2180 void* library = NULL; |
2181 jint result = JNI_ERR; |
2181 jint result = JNI_ERR; |
2182 |
2182 |
2183 // get agent name and options |
2183 // get agent name and options |
2184 const char* agent = op->arg(0); |
2184 const char* agent = op->arg(0); |
2185 const char* absParam = op->arg(1); |
2185 const char* absParam = op->arg(1); |
2194 |
2194 |
2195 if (is_absolute_path) { |
2195 if (is_absolute_path) { |
2196 library = os::dll_load(agent, ebuf, sizeof ebuf); |
2196 library = os::dll_load(agent, ebuf, sizeof ebuf); |
2197 } else { |
2197 } else { |
2198 // Try to load the agent from the standard dll directory |
2198 // Try to load the agent from the standard dll directory |
2199 os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), agent); |
2199 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), |
2200 library = os::dll_load(buffer, ebuf, sizeof ebuf); |
2200 agent)) { |
|
2201 library = os::dll_load(buffer, ebuf, sizeof ebuf); |
|
2202 } |
2201 if (library == NULL) { |
2203 if (library == NULL) { |
2202 // not found - try local path |
2204 // not found - try local path |
2203 char ns[1] = {0}; |
2205 char ns[1] = {0}; |
2204 os::dll_build_name(buffer, sizeof(buffer), ns, agent); |
2206 if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) { |
2205 library = os::dll_load(buffer, ebuf, sizeof ebuf); |
2207 library = os::dll_load(buffer, ebuf, sizeof ebuf); |
|
2208 } |
2206 } |
2209 } |
2207 } |
2210 } |
2208 |
2211 |
2209 // If the library was loaded then we attempt to invoke the Agent_OnAttach |
2212 // If the library was loaded then we attempt to invoke the Agent_OnAttach |
2210 // function |
2213 // function |