Mercurial > hg > truffle
diff src/os/linux/vm/os_linux.cpp @ 242:d95b224e9f17
6721093: -XX:AppendRatio=N not supported
Summary: Add mechanism to ignore unsupported flags for a set period of time
Reviewed-by: acorn, never, coleenp
author | kamg |
---|---|
date | Mon, 28 Jul 2008 14:07:44 -0400 |
parents | 1fdb98a17101 |
children | b7f01ad69d30 |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Sat Jul 19 17:38:22 2008 -0400 +++ b/src/os/linux/vm/os_linux.cpp Mon Jul 28 14:07:44 2008 -0400 @@ -94,6 +94,9 @@ static int SR_signum = SIGUSR2; sigset_t SR_sigset; +/* Used to protect dlsym() calls */ +static pthread_mutex_t dl_mutex; + //////////////////////////////////////////////////////////////////////////////// // utility functions @@ -1493,6 +1496,24 @@ const char* os::get_temp_directory() { return "/tmp/"; } +void os::dll_build_name( + char* buffer, size_t buflen, const char* pname, const char* fname) { + // copied from libhpi + const size_t pnamelen = pname ? strlen(pname) : 0; + + /* Quietly truncate on buffer overflow. Should be an error. */ + if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { + *buffer = '\0'; + return; + } + + if (pnamelen == 0) { + sprintf(buffer, "lib%s.so", fname); + } else { + sprintf(buffer, "%s/lib%s.so", pname, fname); + } +} + const char* os::get_current_directory(char *buf, int buflen) { return getcwd(buf, buflen); } @@ -1742,7 +1763,17 @@ return NULL; } - +/* + * glibc-2.0 libdl is not MT safe. If you are building with any glibc, + * chances are you might want to run the generated bits against glibc-2.0 + * libdl.so, so always use locking for any version of glibc. + */ +void* os::dll_lookup(void* handle, const char* name) { + pthread_mutex_lock(&dl_mutex); + void* res = dlsym(handle, name); + pthread_mutex_unlock(&dl_mutex); + return res; +} bool _print_ascii_file(const char* filename, outputStream* st) { @@ -3581,6 +3612,7 @@ Linux::clock_init(); initial_time_count = os::elapsed_counter(); + pthread_mutex_init(&dl_mutex, NULL); } // To install functions for atexit system call