8195857: Remove os::is_headless_jre
authormbaesken
Sun, 28 Jan 2018 19:49:06 -0500
changeset 48813 c092a2fbb7c3
parent 48812 f43576cfb273
child 48814 f01f81fa1242
8195857: Remove os::is_headless_jre Reviewed-by: goetz, dholmes
src/hotspot/os/aix/os_aix.cpp
src/hotspot/os/bsd/os_bsd.cpp
src/hotspot/os/linux/os_linux.cpp
src/hotspot/os/solaris/os_solaris.cpp
src/hotspot/os/windows/os_windows.cpp
src/hotspot/share/runtime/arguments.cpp
src/hotspot/share/runtime/os.hpp
--- a/src/hotspot/os/aix/os_aix.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/os/aix/os_aix.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -4244,48 +4244,6 @@
   return -1;
 }
 
-// is_headless_jre()
-//
-// Test for the existence of xawt/libmawt.so or libawt_xawt.so
-// in order to report if we are running in a headless jre.
-//
-// Since JDK8 xawt/libmawt.so is moved into the same directory
-// as libawt.so, and renamed libawt_xawt.so
-bool os::is_headless_jre() {
-  struct stat statbuf;
-  char buf[MAXPATHLEN];
-  char libmawtpath[MAXPATHLEN];
-  const char *xawtstr = "/xawt/libmawt.so";
-  const char *new_xawtstr = "/libawt_xawt.so";
-
-  char *p;
-
-  // Get path to libjvm.so
-  os::jvm_path(buf, sizeof(buf));
-
-  // Get rid of libjvm.so
-  p = strrchr(buf, '/');
-  if (p == NULL) return false;
-  else *p = '\0';
-
-  // Get rid of client or server
-  p = strrchr(buf, '/');
-  if (p == NULL) return false;
-  else *p = '\0';
-
-  // check xawt/libmawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  // check libawt_xawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, new_xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  return true;
-}
-
 // Get the default path to the core file
 // Returns the length of the string
 int os::get_core_path(char* buffer, size_t bufferSize) {
--- a/src/hotspot/os/bsd/os_bsd.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -3894,59 +3894,6 @@
   }
 }
 
-// is_headless_jre()
-//
-// Test for the existence of xawt/libmawt.so or libawt_xawt.so
-// in order to report if we are running in a headless jre
-//
-// Since JDK8 xawt/libmawt.so was moved into the same directory
-// as libawt.so, and renamed libawt_xawt.so
-//
-bool os::is_headless_jre() {
-#ifdef __APPLE__
-  // We no longer build headless-only on Mac OS X
-  return false;
-#else
-  struct stat statbuf;
-  char buf[MAXPATHLEN];
-  char libmawtpath[MAXPATHLEN];
-  const char *xawtstr  = "/xawt/libmawt" JNI_LIB_SUFFIX;
-  const char *new_xawtstr = "/libawt_xawt" JNI_LIB_SUFFIX;
-  char *p;
-
-  // Get path to libjvm.so
-  os::jvm_path(buf, sizeof(buf));
-
-  // Get rid of libjvm.so
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // Get rid of client or server
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // check xawt/libmawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  // check libawt_xawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, new_xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  return true;
-#endif
-}
-
 // Get the default path to the core file
 // Returns the length of the string
 int os::get_core_path(char* buffer, size_t bufferSize) {
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -5690,54 +5690,6 @@
   }
 }
 
-// is_headless_jre()
-//
-// Test for the existence of xawt/libmawt.so or libawt_xawt.so
-// in order to report if we are running in a headless jre
-//
-// Since JDK8 xawt/libmawt.so was moved into the same directory
-// as libawt.so, and renamed libawt_xawt.so
-//
-bool os::is_headless_jre() {
-  struct stat statbuf;
-  char buf[MAXPATHLEN];
-  char libmawtpath[MAXPATHLEN];
-  const char *xawtstr  = "/xawt/libmawt.so";
-  const char *new_xawtstr = "/libawt_xawt.so";
-  char *p;
-
-  // Get path to libjvm.so
-  os::jvm_path(buf, sizeof(buf));
-
-  // Get rid of libjvm.so
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // Get rid of client or server
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // check xawt/libmawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  // check libawt_xawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, new_xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  return true;
-}
-
 // Get the default path to the core file
 // Returns the length of the string
 int os::get_core_path(char* buffer, size_t bufferSize) {
--- a/src/hotspot/os/solaris/os_solaris.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -5366,54 +5366,6 @@
   }
 }
 
-// is_headless_jre()
-//
-// Test for the existence of xawt/libmawt.so or libawt_xawt.so
-// in order to report if we are running in a headless jre
-//
-// Since JDK8 xawt/libmawt.so was moved into the same directory
-// as libawt.so, and renamed libawt_xawt.so
-//
-bool os::is_headless_jre() {
-  struct stat statbuf;
-  char buf[MAXPATHLEN];
-  char libmawtpath[MAXPATHLEN];
-  const char *xawtstr  = "/xawt/libmawt.so";
-  const char *new_xawtstr = "/libawt_xawt.so";
-  char *p;
-
-  // Get path to libjvm.so
-  os::jvm_path(buf, sizeof(buf));
-
-  // Get rid of libjvm.so
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // Get rid of client or server
-  p = strrchr(buf, '/');
-  if (p == NULL) {
-    return false;
-  } else {
-    *p = '\0';
-  }
-
-  // check xawt/libmawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  // check libawt_xawt.so
-  strcpy(libmawtpath, buf);
-  strcat(libmawtpath, new_xawtstr);
-  if (::stat(libmawtpath, &statbuf) == 0) return false;
-
-  return true;
-}
-
 size_t os::write(int fd, const void *buf, unsigned int nBytes) {
   size_t res;
   RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
--- a/src/hotspot/os/windows/os_windows.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/os/windows/os_windows.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -5262,9 +5262,6 @@
   return EXCEPTION_CONTINUE_SEARCH;
 }
 
-// We don't build a headless jre for Windows
-bool os::is_headless_jre() { return false; }
-
 static jint initSock() {
   WSADATA wsadata;
 
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Sun Jan 28 19:49:06 2018 -0500
@@ -3458,27 +3458,6 @@
   }
 #endif
 
-  // If we are running in a headless jre, force java.awt.headless property
-  // to be true unless the property has already been set.
-  // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
-  if (os::is_headless_jre()) {
-    const char* headless = Arguments::get_property("java.awt.headless");
-    if (headless == NULL) {
-      const char *headless_env = ::getenv("JAVA_AWT_HEADLESS");
-      if (headless_env == NULL) {
-        if (!add_property("java.awt.headless=true")) {
-          return JNI_ENOMEM;
-        }
-      } else {
-        char buffer[256];
-        jio_snprintf(buffer, sizeof(buffer), "java.awt.headless=%s", headless_env);
-        if (!add_property(buffer)) {
-          return JNI_ENOMEM;
-        }
-      }
-    }
-  }
-
   if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
--- a/src/hotspot/share/runtime/os.hpp	Wed Jan 24 18:00:36 2018 -0500
+++ b/src/hotspot/share/runtime/os.hpp	Sun Jan 28 19:49:06 2018 -0500
@@ -717,9 +717,6 @@
   // Fills in path to jvm.dll/libjvm.so (used by the Disassembler)
   static void     jvm_path(char *buf, jint buflen);
 
-  // Returns true if we are running in a headless jre.
-  static bool     is_headless_jre();
-
   // JNI names
   static void     print_jni_name_prefix_on(outputStream* st, int args_size);
   static void     print_jni_name_suffix_on(outputStream* st, int args_size);