src/hotspot/os/bsd/os_bsd.cpp
changeset 48813 c092a2fbb7c3
parent 48635 612dfa1d8aad
child 48865 53427ddce0a0
equal deleted inserted replaced
48812:f43576cfb273 48813:c092a2fbb7c3
  3892       return status;
  3892       return status;
  3893     }
  3893     }
  3894   }
  3894   }
  3895 }
  3895 }
  3896 
  3896 
  3897 // is_headless_jre()
       
  3898 //
       
  3899 // Test for the existence of xawt/libmawt.so or libawt_xawt.so
       
  3900 // in order to report if we are running in a headless jre
       
  3901 //
       
  3902 // Since JDK8 xawt/libmawt.so was moved into the same directory
       
  3903 // as libawt.so, and renamed libawt_xawt.so
       
  3904 //
       
  3905 bool os::is_headless_jre() {
       
  3906 #ifdef __APPLE__
       
  3907   // We no longer build headless-only on Mac OS X
       
  3908   return false;
       
  3909 #else
       
  3910   struct stat statbuf;
       
  3911   char buf[MAXPATHLEN];
       
  3912   char libmawtpath[MAXPATHLEN];
       
  3913   const char *xawtstr  = "/xawt/libmawt" JNI_LIB_SUFFIX;
       
  3914   const char *new_xawtstr = "/libawt_xawt" JNI_LIB_SUFFIX;
       
  3915   char *p;
       
  3916 
       
  3917   // Get path to libjvm.so
       
  3918   os::jvm_path(buf, sizeof(buf));
       
  3919 
       
  3920   // Get rid of libjvm.so
       
  3921   p = strrchr(buf, '/');
       
  3922   if (p == NULL) {
       
  3923     return false;
       
  3924   } else {
       
  3925     *p = '\0';
       
  3926   }
       
  3927 
       
  3928   // Get rid of client or server
       
  3929   p = strrchr(buf, '/');
       
  3930   if (p == NULL) {
       
  3931     return false;
       
  3932   } else {
       
  3933     *p = '\0';
       
  3934   }
       
  3935 
       
  3936   // check xawt/libmawt.so
       
  3937   strcpy(libmawtpath, buf);
       
  3938   strcat(libmawtpath, xawtstr);
       
  3939   if (::stat(libmawtpath, &statbuf) == 0) return false;
       
  3940 
       
  3941   // check libawt_xawt.so
       
  3942   strcpy(libmawtpath, buf);
       
  3943   strcat(libmawtpath, new_xawtstr);
       
  3944   if (::stat(libmawtpath, &statbuf) == 0) return false;
       
  3945 
       
  3946   return true;
       
  3947 #endif
       
  3948 }
       
  3949 
       
  3950 // Get the default path to the core file
  3897 // Get the default path to the core file
  3951 // Returns the length of the string
  3898 // Returns the length of the string
  3952 int os::get_core_path(char* buffer, size_t bufferSize) {
  3899 int os::get_core_path(char* buffer, size_t bufferSize) {
  3953   int n = jio_snprintf(buffer, bufferSize, "/cores/core.%d", current_process_id());
  3900   int n = jio_snprintf(buffer, bufferSize, "/cores/core.%d", current_process_id());
  3954 
  3901