43 #include <string.h>
44
45 #include "path_md.h"
46 #ifndef NATIVE
47 #include "iomgr.h"
48 #include "threads_md.h"
49 #endif
50
51 #ifdef __APPLE__
52 #define LIB_SUFFIX "dylib"
53 #else
54 #define LIB_SUFFIX "so"
55 #endif
56
57 static void dll_build_name(char* buffer, size_t buflen,
58 const char* pname, const char* fname) {
59 // Based on os_solaris.cpp
60
61 char *path_sep = PATH_SEPARATOR;
62 char *pathname = (char *)pname;
63 while (strlen(pathname) > 0) {
64 char *p = strchr(pathname, *path_sep);
65 if (p == NULL) {
66 p = pathname + strlen(pathname);
67 }
68 /* check for NULL path */
69 if (p == pathname) {
70 continue;
71 }
72 (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (p - pathname),
73 pathname, fname);
74
75 if (access(buffer, F_OK) == 0) {
76 break;
77 }
78 pathname = p + 1;
79 *buffer = '\0';
80 }
81 }
82
83 /*
84 * create a string for the JNI native function name by adding the
85 * appropriate decorations.
86 */
87 int
88 dbgsysBuildFunName(char *name, int nameLen, int args_size, int encodingIndex)
89 {
90 /* On Solaris, there is only one encoding method. */
91 if (encodingIndex == 0)
92 return 1;
93 return 0;
94 }
95
96 /*
97 * create a string for the dynamic lib open call by adding the
98 * appropriate pre and extensions to a filename and the path
|
43 #include <string.h>
44
45 #include "path_md.h"
46 #ifndef NATIVE
47 #include "iomgr.h"
48 #include "threads_md.h"
49 #endif
50
51 #ifdef __APPLE__
52 #define LIB_SUFFIX "dylib"
53 #else
54 #define LIB_SUFFIX "so"
55 #endif
56
57 static void dll_build_name(char* buffer, size_t buflen,
58 const char* pname, const char* fname) {
59 // Based on os_solaris.cpp
60
61 char *path_sep = PATH_SEPARATOR;
62 char *pathname = (char *)pname;
63 *buffer = '\0';
64 while (strlen(pathname) > 0) {
65 char *p = strchr(pathname, *path_sep);
66 if (p == NULL) {
67 p = pathname + strlen(pathname);
68 }
69 /* check for NULL path */
70 if (p == pathname) {
71 continue;
72 }
73 (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (int)(p - pathname),
74 pathname, fname);
75
76 if (access(buffer, F_OK) == 0) {
77 break;
78 }
79 if (*p == '\0') {
80 pathname = p;
81 } else {
82 pathname = p + 1;
83 }
84 *buffer = '\0';
85 }
86 }
87
88 /*
89 * create a string for the JNI native function name by adding the
90 * appropriate decorations.
91 */
92 int
93 dbgsysBuildFunName(char *name, int nameLen, int args_size, int encodingIndex)
94 {
95 /* On Solaris, there is only one encoding method. */
96 if (encodingIndex == 0)
97 return 1;
98 return 0;
99 }
100
101 /*
102 * create a string for the dynamic lib open call by adding the
103 * appropriate pre and extensions to a filename and the path
|