< prev index next >

src/hotspot/share/runtime/os.cpp

Print this page




 212 
 213 // The mapping from OS priority back to Java priority may be inexact because
 214 // Java priorities can map M:1 with native priorities. If you want the definite
 215 // Java priority then use JavaThread::java_priority()
 216 OSReturn os::get_priority(const Thread* const thread, ThreadPriority& priority) {
 217   int p;
 218   int os_prio;
 219   OSReturn ret = get_native_priority(thread, &os_prio);
 220   if (ret != OS_OK) return ret;
 221 
 222   if (java_to_os_priority[MaxPriority] > java_to_os_priority[MinPriority]) {
 223     for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ;
 224   } else {
 225     // niceness values are in reverse order
 226     for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] < os_prio; p--) ;
 227   }
 228   priority = (ThreadPriority)p;
 229   return OS_OK;
 230 }
 231 







 232 bool os::dll_build_name(char* buffer, size_t size, const char* fname) {
 233   int n = jio_snprintf(buffer, size, "%s%s%s", JNI_LIB_PREFIX, fname, JNI_LIB_SUFFIX);
 234   return (n != -1);
 235 }
 236 
 237 // Helper for dll_locate_lib.
 238 // Pass buffer and printbuffer as we already printed the path to buffer
 239 // when we called get_current_directory. This way we avoid another buffer
 240 // of size MAX_PATH.
 241 static bool conc_path_file_and_check(char *buffer, char *printbuffer, size_t printbuflen,
 242                                      const char* pname, char lastchar, const char* fname) {
 243 
 244   // Concatenate path and file name, but don't print double path separators.
 245   const char *filesep = (WINDOWS_ONLY(lastchar == ':' ||) lastchar == os::file_separator()[0]) ?
 246                         "" : os::file_separator();
 247   int ret = jio_snprintf(printbuffer, printbuflen, "%s%s%s", pname, filesep, fname);
 248   // Check whether file exists.
 249   if (ret != -1) {
 250     struct stat statbuf;
 251     return os::stat(buffer, &statbuf) == 0;




 212 
 213 // The mapping from OS priority back to Java priority may be inexact because
 214 // Java priorities can map M:1 with native priorities. If you want the definite
 215 // Java priority then use JavaThread::java_priority()
 216 OSReturn os::get_priority(const Thread* const thread, ThreadPriority& priority) {
 217   int p;
 218   int os_prio;
 219   OSReturn ret = get_native_priority(thread, &os_prio);
 220   if (ret != OS_OK) return ret;
 221 
 222   if (java_to_os_priority[MaxPriority] > java_to_os_priority[MinPriority]) {
 223     for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] > os_prio; p--) ;
 224   } else {
 225     // niceness values are in reverse order
 226     for (p = MaxPriority; p > MinPriority && java_to_os_priority[p] < os_prio; p--) ;
 227   }
 228   priority = (ThreadPriority)p;
 229   return OS_OK;
 230 }
 231 
 232 
 233 #if !defined(LINUX) && !defined(_WINDOWS)
 234 size_t os::committed_stack_size(address bottom, size_t size) {
 235   return size;
 236 }
 237 #endif
 238 
 239 bool os::dll_build_name(char* buffer, size_t size, const char* fname) {
 240   int n = jio_snprintf(buffer, size, "%s%s%s", JNI_LIB_PREFIX, fname, JNI_LIB_SUFFIX);
 241   return (n != -1);
 242 }
 243 
 244 // Helper for dll_locate_lib.
 245 // Pass buffer and printbuffer as we already printed the path to buffer
 246 // when we called get_current_directory. This way we avoid another buffer
 247 // of size MAX_PATH.
 248 static bool conc_path_file_and_check(char *buffer, char *printbuffer, size_t printbuflen,
 249                                      const char* pname, char lastchar, const char* fname) {
 250 
 251   // Concatenate path and file name, but don't print double path separators.
 252   const char *filesep = (WINDOWS_ONLY(lastchar == ':' ||) lastchar == os::file_separator()[0]) ?
 253                         "" : os::file_separator();
 254   int ret = jio_snprintf(printbuffer, printbuflen, "%s%s%s", pname, filesep, fname);
 255   // Check whether file exists.
 256   if (ret != -1) {
 257     struct stat statbuf;
 258     return os::stat(buffer, &statbuf) == 0;


< prev index next >