src/share/back/transport.c

Print this page
rev 6641 : [mq]: PrivateTransportTest


 100 loadTransportLibrary(char *libdir, char *name)
 101 {
 102     void *handle;
 103     char libname[MAXPATHLEN+2];
 104     char buf[MAXPATHLEN*2+100];
 105     char *plibdir;
 106 
 107     /* Convert libdir from UTF-8 to platform encoding */
 108     plibdir = NULL;
 109     if ( libdir != NULL ) {
 110         int  len;
 111 
 112         len = (int)strlen(libdir);
 113         (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
 114             (jbyte*)libdir, len, buf, (int)sizeof(buf));
 115         plibdir = buf;
 116     }
 117 
 118     /* Construct library name (simple name or full path) */
 119     dbgsysBuildLibName(libname, sizeof(libname), plibdir, name);



 120 
 121     /* dlopen (unix) / LoadLibrary (windows) the transport library */
 122     handle = dbgsysLoadLibrary(libname, buf, sizeof(buf));
 123     return handle;
 124 }
 125 
 126 /*
 127  * loadTransport() is adapted from loadJVMHelperLib() in
 128  * JDK 1.2 javai.c v1.61
 129  */
 130 static jdwpError
 131 loadTransport(char *name, jdwpTransportEnv **transportPtr)
 132 {
 133     JNIEnv                 *env;
 134     jdwpTransport_OnLoad_t  onLoad;
 135     void                   *handle;
 136     char                   *libdir;
 137 
 138     /* Make sure library name is not empty */
 139     if (name == NULL) {




 100 loadTransportLibrary(char *libdir, char *name)
 101 {
 102     void *handle;
 103     char libname[MAXPATHLEN+2];
 104     char buf[MAXPATHLEN*2+100];
 105     char *plibdir;
 106 
 107     /* Convert libdir from UTF-8 to platform encoding */
 108     plibdir = NULL;
 109     if ( libdir != NULL ) {
 110         int  len;
 111 
 112         len = (int)strlen(libdir);
 113         (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf,
 114             (jbyte*)libdir, len, buf, (int)sizeof(buf));
 115         plibdir = buf;
 116     }
 117 
 118     /* Construct library name (simple name or full path) */
 119     dbgsysBuildLibName(libname, sizeof(libname), plibdir, name);
 120     if (strlen(libname) == 0) {
 121         return NULL;
 122     }
 123 
 124     /* dlopen (unix) / LoadLibrary (windows) the transport library */
 125     handle = dbgsysLoadLibrary(libname, buf, sizeof(buf));
 126     return handle;
 127 }
 128 
 129 /*
 130  * loadTransport() is adapted from loadJVMHelperLib() in
 131  * JDK 1.2 javai.c v1.61
 132  */
 133 static jdwpError
 134 loadTransport(char *name, jdwpTransportEnv **transportPtr)
 135 {
 136     JNIEnv                 *env;
 137     jdwpTransport_OnLoad_t  onLoad;
 138     void                   *handle;
 139     char                   *libdir;
 140 
 141     /* Make sure library name is not empty */
 142     if (name == NULL) {