src/hotspot/os/linux/os_linux.cpp
changeset 48813 c092a2fbb7c3
parent 48635 612dfa1d8aad
child 48865 53427ddce0a0
equal deleted inserted replaced
48812:f43576cfb273 48813:c092a2fbb7c3
  5688       return status;
  5688       return status;
  5689     }
  5689     }
  5690   }
  5690   }
  5691 }
  5691 }
  5692 
  5692 
  5693 // is_headless_jre()
       
  5694 //
       
  5695 // Test for the existence of xawt/libmawt.so or libawt_xawt.so
       
  5696 // in order to report if we are running in a headless jre
       
  5697 //
       
  5698 // Since JDK8 xawt/libmawt.so was moved into the same directory
       
  5699 // as libawt.so, and renamed libawt_xawt.so
       
  5700 //
       
  5701 bool os::is_headless_jre() {
       
  5702   struct stat statbuf;
       
  5703   char buf[MAXPATHLEN];
       
  5704   char libmawtpath[MAXPATHLEN];
       
  5705   const char *xawtstr  = "/xawt/libmawt.so";
       
  5706   const char *new_xawtstr = "/libawt_xawt.so";
       
  5707   char *p;
       
  5708 
       
  5709   // Get path to libjvm.so
       
  5710   os::jvm_path(buf, sizeof(buf));
       
  5711 
       
  5712   // Get rid of libjvm.so
       
  5713   p = strrchr(buf, '/');
       
  5714   if (p == NULL) {
       
  5715     return false;
       
  5716   } else {
       
  5717     *p = '\0';
       
  5718   }
       
  5719 
       
  5720   // Get rid of client or server
       
  5721   p = strrchr(buf, '/');
       
  5722   if (p == NULL) {
       
  5723     return false;
       
  5724   } else {
       
  5725     *p = '\0';
       
  5726   }
       
  5727 
       
  5728   // check xawt/libmawt.so
       
  5729   strcpy(libmawtpath, buf);
       
  5730   strcat(libmawtpath, xawtstr);
       
  5731   if (::stat(libmawtpath, &statbuf) == 0) return false;
       
  5732 
       
  5733   // check libawt_xawt.so
       
  5734   strcpy(libmawtpath, buf);
       
  5735   strcat(libmawtpath, new_xawtstr);
       
  5736   if (::stat(libmawtpath, &statbuf) == 0) return false;
       
  5737 
       
  5738   return true;
       
  5739 }
       
  5740 
       
  5741 // Get the default path to the core file
  5693 // Get the default path to the core file
  5742 // Returns the length of the string
  5694 // Returns the length of the string
  5743 int os::get_core_path(char* buffer, size_t bufferSize) {
  5695 int os::get_core_path(char* buffer, size_t bufferSize) {
  5744   /*
  5696   /*
  5745    * Max length of /proc/sys/kernel/core_pattern is 128 characters.
  5697    * Max length of /proc/sys/kernel/core_pattern is 128 characters.