< prev index next >

src/java.base/unix/native/libjli/java_md_solinux.c

Print this page




 756         dlsym(libjvm, "JNI_CreateJavaVM");
 757     if (ifn->CreateJavaVM == NULL) {
 758         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 759         return JNI_FALSE;
 760     }
 761 
 762     ifn->GetDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs_t)
 763         dlsym(libjvm, "JNI_GetDefaultJavaVMInitArgs");
 764     if (ifn->GetDefaultJavaVMInitArgs == NULL) {
 765         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 766         return JNI_FALSE;
 767     }
 768 
 769     ifn->GetCreatedJavaVMs = (GetCreatedJavaVMs_t)
 770         dlsym(libjvm, "JNI_GetCreatedJavaVMs");
 771     if (ifn->GetCreatedJavaVMs == NULL) {
 772         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 773         return JNI_FALSE;
 774     }
 775 







 776     return JNI_TRUE;
 777 }
 778 
 779 /*
 780  * Compute the name of the executable
 781  *
 782  * In order to re-exec securely we need the absolute path of the
 783  * executable. On Solaris getexecname(3c) may not return an absolute
 784  * path so we use dladdr to get the filename of the executable and
 785  * then use realpath to derive an absolute path. From Solaris 9
 786  * onwards the filename returned in DL_info structure from dladdr is
 787  * an absolute pathname so technically realpath isn't required.
 788  * On Linux we read the executable name from /proc/self/exe.
 789  * As a fallback, and for platforms other than Solaris and Linux,
 790  * we use FindExecName to compute the executable name.
 791  */
 792 const char*
 793 SetExecname(char **argv)
 794 {
 795     char* exec_path = NULL;




 756         dlsym(libjvm, "JNI_CreateJavaVM");
 757     if (ifn->CreateJavaVM == NULL) {
 758         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 759         return JNI_FALSE;
 760     }
 761 
 762     ifn->GetDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs_t)
 763         dlsym(libjvm, "JNI_GetDefaultJavaVMInitArgs");
 764     if (ifn->GetDefaultJavaVMInitArgs == NULL) {
 765         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 766         return JNI_FALSE;
 767     }
 768 
 769     ifn->GetCreatedJavaVMs = (GetCreatedJavaVMs_t)
 770         dlsym(libjvm, "JNI_GetCreatedJavaVMs");
 771     if (ifn->GetCreatedJavaVMs == NULL) {
 772         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 773         return JNI_FALSE;
 774     }
 775 
 776     ifn->SetNativeThreadName0 = (SetNativeThreadName0_t)
 777         dlsym(libjvm, "JVM_SetNativeThreadName0");
 778     if (ifn->SetNativeThreadName0 == NULL) {
 779         JLI_ReportErrorMessage(DLL_ERROR2, jvmpath, dlerror());
 780         return JNI_FALSE;
 781     }
 782 
 783     return JNI_TRUE;
 784 }
 785 
 786 /*
 787  * Compute the name of the executable
 788  *
 789  * In order to re-exec securely we need the absolute path of the
 790  * executable. On Solaris getexecname(3c) may not return an absolute
 791  * path so we use dladdr to get the filename of the executable and
 792  * then use realpath to derive an absolute path. From Solaris 9
 793  * onwards the filename returned in DL_info structure from dladdr is
 794  * an absolute pathname so technically realpath isn't required.
 795  * On Linux we read the executable name from /proc/self/exe.
 796  * As a fallback, and for platforms other than Solaris and Linux,
 797  * we use FindExecName to compute the executable name.
 798  */
 799 const char*
 800 SetExecname(char **argv)
 801 {
 802     char* exec_path = NULL;


< prev index next >