Merge JDK-8200758-branch
authorherrick
Thu, 19 Jul 2018 11:37:18 -0400
branchJDK-8200758-branch
changeset 56838 4b73e9ef108a
parent 56837 d63675085e09 (current diff)
parent 51117 c96c7d08ae49 (diff)
child 56847 77e4d458678e
Merge
test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java
test/hotspot/jtreg/runtime/appcds/test-classes/CheckIfShared.java
--- a/src/hotspot/os/aix/os_aix.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/aix/os_aix.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -3733,8 +3733,7 @@
 
   /* Scan the directory */
   bool result = true;
-  char buf[sizeof(struct dirent) + MAX_PATH];
-  while (result && (ptr = ::readdir(dir)) != NULL) {
+  while (result && (ptr = readdir(dir)) != NULL) {
     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
       result = false;
     }
--- a/src/hotspot/os/aix/os_aix.inline.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/aix/os_aix.inline.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -74,17 +74,6 @@
 
 inline const int os::default_file_open_flags() { return 0;}
 
-inline DIR* os::opendir(const char* dirname) {
-  assert(dirname != NULL, "just checking");
-  return ::opendir(dirname);
-}
-
-inline int os::readdir_buf_size(const char *path) {
-  // According to aix sys/limits, NAME_MAX must be retrieved at runtime.
-  const long my_NAME_MAX = pathconf(path, _PC_NAME_MAX);
-  return my_NAME_MAX + sizeof(dirent) + 1;
-}
-
 inline jlong os::lseek(int fd, jlong offset, int whence) {
   return (jlong) ::lseek64(fd, offset, whence);
 }
@@ -97,23 +86,6 @@
   return ::ftruncate64(fd, length);
 }
 
-inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) {
-  dirent* p = NULL;
-  assert(dirp != NULL, "just checking");
-
-  // AIX: slightly different from POSIX.
-  // On AIX, readdir_r returns 0 or != 0 and error details in errno.
-  if (::readdir_r(dirp, dbuf, &p) != 0) {
-    return NULL;
-  }
-  return p;
-}
-
-inline int os::closedir(DIR *dirp) {
-  assert(dirp != NULL, "argument is NULL");
-  return ::closedir(dirp);
-}
-
 // macros for restartable system calls
 
 #define RESTARTABLE(_cmd, _result) do { \
--- a/src/hotspot/os/aix/os_perf_aix.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/aix/os_perf_aix.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -893,21 +893,14 @@
 }
 
 int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() {
-  struct dirent* entry;
-
   if (!is_valid()) {
     return OS_ERR;
   }
 
   do {
-      entry = os::readdir(_dir, _entry);
-    if (entry == NULL) {
-      // error
-      _valid = false;
-      return OS_ERR;
-    }
+    _entry = os::readdir(_dir);
     if (_entry == NULL) {
-      // reached end
+      // Error or reached end.  Could use errno to distinguish those cases.
       _valid = false;
       return OS_ERR;
     }
@@ -929,11 +922,8 @@
 }
 
 SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() {
-  if (_entry != NULL) {
-    FREE_C_HEAP_ARRAY(char, _entry);
-  }
   if (_dir != NULL) {
-    closedir(_dir);
+    os::closedir(_dir);
   }
 }
 
--- a/src/hotspot/os/aix/perfMemory_aix.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/aix/perfMemory_aix.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -617,9 +617,8 @@
   // to determine the user name for the process id.
   //
   struct dirent* dentry;
-  char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
   errno = 0;
-  while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
+  while ((dentry = os::readdir(tmpdirp)) != NULL) {
 
     // check if the directory entry is a hsperfdata file
     if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) {
@@ -653,9 +652,8 @@
     }
 
     struct dirent* udentry;
-    char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
-    while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
+    while ((udentry = os::readdir(subdirp)) != NULL) {
 
       if (filename_to_pid(udentry->d_name) == vmid) {
         struct stat statbuf;
@@ -699,11 +697,9 @@
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf);
     FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -779,10 +775,8 @@
   // loop under these conditions is dependent upon the implementation of
   // opendir/readdir.
   struct dirent* entry;
-  char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
-
   errno = 0;
-  while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
+  while ((entry = os::readdir(dirp)) != NULL) {
 
     pid_t pid = filename_to_pid(entry->d_name);
 
@@ -820,8 +814,6 @@
 
   // Close the directory and reset the current working directory.
   close_directory_secure_cwd(dirp, saved_cwd_fd);
-
-  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // Make the user specific temporary directory. Returns true if
--- a/src/hotspot/os/bsd/os_bsd.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -3506,8 +3506,7 @@
 
   // Scan the directory
   bool result = true;
-  char buf[sizeof(struct dirent) + MAX_PATH];
-  while (result && (ptr = ::readdir(dir)) != NULL) {
+  while (result && (ptr = readdir(dir)) != NULL) {
     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
       result = false;
     }
--- a/src/hotspot/os/bsd/os_bsd.inline.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/bsd/os_bsd.inline.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -77,17 +77,6 @@
 
 inline const int os::default_file_open_flags() { return 0;}
 
-inline DIR* os::opendir(const char* dirname)
-{
-  assert(dirname != NULL, "just checking");
-  return ::opendir(dirname);
-}
-
-inline int os::readdir_buf_size(const char *path)
-{
-  return NAME_MAX + sizeof(dirent) + 1;
-}
-
 inline jlong os::lseek(int fd, jlong offset, int whence) {
   return (jlong) ::lseek(fd, offset, whence);
 }
@@ -100,28 +89,6 @@
   return ::ftruncate(fd, length);
 }
 
-inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
-{
-  dirent* p;
-  int status;
-  assert(dirp != NULL, "just checking");
-
-  // NOTE: Bsd readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
-  // version. Here is the doc for this function:
-  // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
-
-  if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
-    errno = status;
-    return NULL;
-  } else
-    return p;
-}
-
-inline int os::closedir(DIR *dirp) {
-  assert(dirp != NULL, "argument is NULL");
-  return ::closedir(dirp);
-}
-
 // macros for restartable system calls
 
 #define RESTARTABLE(_cmd, _result) do { \
--- a/src/hotspot/os/bsd/perfMemory_bsd.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/bsd/perfMemory_bsd.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -535,9 +535,8 @@
   // to determine the user name for the process id.
   //
   struct dirent* dentry;
-  char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
   errno = 0;
-  while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
+  while ((dentry = os::readdir(tmpdirp)) != NULL) {
 
     // check if the directory entry is a hsperfdata file
     if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) {
@@ -559,9 +558,8 @@
     }
 
     struct dirent* udentry;
-    char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
-    while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
+    while ((udentry = os::readdir(subdirp)) != NULL) {
 
       if (filename_to_pid(udentry->d_name) == vmid) {
         struct stat statbuf;
@@ -605,11 +603,9 @@
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf);
     FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -688,10 +684,8 @@
   // opendir/readdir.
   //
   struct dirent* entry;
-  char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
-
   errno = 0;
-  while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
+  while ((entry = os::readdir(dirp)) != NULL) {
 
     pid_t pid = filename_to_pid(entry->d_name);
 
@@ -730,8 +724,6 @@
 
   // close the directory and reset the current working directory
   close_directory_secure_cwd(dirp, saved_cwd_fd);
-
-  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
--- a/src/hotspot/os/linux/os_linux.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/linux/os_linux.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -5375,8 +5375,7 @@
 
   // Scan the directory
   bool result = true;
-  char buf[sizeof(struct dirent) + MAX_PATH];
-  while (result && (ptr = ::readdir(dir)) != NULL) {
+  while (result && (ptr = readdir(dir)) != NULL) {
     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
       result = false;
     }
--- a/src/hotspot/os/linux/os_linux.inline.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/linux/os_linux.inline.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -69,17 +69,6 @@
 
 inline const int os::default_file_open_flags() { return 0;}
 
-inline DIR* os::opendir(const char* dirname)
-{
-  assert(dirname != NULL, "just checking");
-  return ::opendir(dirname);
-}
-
-inline int os::readdir_buf_size(const char *path)
-{
-  return NAME_MAX + sizeof(dirent) + 1;
-}
-
 inline jlong os::lseek(int fd, jlong offset, int whence) {
   return (jlong) ::lseek64(fd, offset, whence);
 }
@@ -92,17 +81,6 @@
   return ::ftruncate64(fd, length);
 }
 
-inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
-{
-  assert(dirp != NULL, "just checking");
-  return ::readdir(dirp);
-}
-
-inline int os::closedir(DIR *dirp) {
-  assert(dirp != NULL, "argument is NULL");
-  return ::closedir(dirp);
-}
-
 // macros for restartable system calls
 
 #define RESTARTABLE(_cmd, _result) do { \
--- a/src/hotspot/os/linux/os_perf_linux.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/linux/os_perf_linux.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -895,21 +895,14 @@
 }
 
 int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() {
-  struct dirent* entry;
-
   if (!is_valid()) {
     return OS_ERR;
   }
 
   do {
-      entry = os::readdir(_dir, _entry);
-    if (entry == NULL) {
-      // error
-      _valid = false;
-      return OS_ERR;
-    }
+    _entry = os::readdir(_dir);
     if (_entry == NULL) {
-      // reached end
+      // Error or reached end.  Could use errno to distinguish those cases.
       _valid = false;
       return OS_ERR;
     }
@@ -926,11 +919,8 @@
 }
 
 bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
-  _dir = opendir("/proc");
-  _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct dirent) + NAME_MAX + 1, mtInternal);
-  if (NULL == _entry) {
-    return false;
-  }
+  _dir = os::opendir("/proc");
+  _entry = NULL;
   _valid = true;
   next_process();
 
@@ -938,11 +928,8 @@
 }
 
 SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() {
-  if (_entry != NULL) {
-    FREE_C_HEAP_ARRAY(char, _entry);
-  }
   if (_dir != NULL) {
-    closedir(_dir);
+    os::closedir(_dir);
   }
 }
 
--- a/src/hotspot/os/linux/perfMemory_linux.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/linux/perfMemory_linux.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -561,9 +561,8 @@
   // to determine the user name for the process id.
   //
   struct dirent* dentry;
-  char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
   errno = 0;
-  while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
+  while ((dentry = os::readdir(tmpdirp)) != NULL) {
 
     // check if the directory entry is a hsperfdata file
     if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) {
@@ -597,9 +596,8 @@
     }
 
     struct dirent* udentry;
-    char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
-    while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
+    while ((udentry = os::readdir(subdirp)) != NULL) {
 
       if (filename_to_pid(udentry->d_name) == searchpid) {
         struct stat statbuf;
@@ -643,11 +641,9 @@
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf);
     FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -769,10 +765,8 @@
   // opendir/readdir.
   //
   struct dirent* entry;
-  char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
-
   errno = 0;
-  while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
+  while ((entry = os::readdir(dirp)) != NULL) {
 
     pid_t pid = filename_to_pid(entry->d_name);
 
@@ -809,8 +803,6 @@
 
   // close the directory and reset the current working directory
   close_directory_secure_cwd(dirp, saved_cwd_fd);
-
-  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
--- a/src/hotspot/os/posix/os_posix.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/posix/os_posix.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -35,6 +35,7 @@
 #include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
+#include <dirent.h>
 #include <dlfcn.h>
 #include <pthread.h>
 #include <signal.h>
@@ -527,6 +528,21 @@
   ::funlockfile(fp);
 }
 
+DIR* os::opendir(const char* dirname) {
+  assert(dirname != NULL, "just checking");
+  return ::opendir(dirname);
+}
+
+struct dirent* os::readdir(DIR* dirp) {
+  assert(dirp != NULL, "just checking");
+  return ::readdir(dirp);
+}
+
+int os::closedir(DIR *dirp) {
+  assert(dirp != NULL, "just checking");
+  return ::closedir(dirp);
+}
+
 // Builds a platform dependent Agent_OnLoad_<lib_name> function name
 // which is used to find statically linked in agents.
 // Parameters:
--- a/src/hotspot/os/solaris/os_perf_solaris.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/solaris/os_perf_solaris.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -604,15 +604,14 @@
 }
 
 int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() {
-  struct dirent* entry;
-
   if (!is_valid()) {
     return OS_ERR;
   }
 
   do {
-    if ((entry = os::readdir(_dir, _entry)) == NULL) {
-      // error
+    _entry = os::readdir(_dir);
+    if (_entry == NULL) {
+      // Error or reached end.  Could use errno to distinguish those cases.
       _valid = false;
       return OS_ERR;
     }
@@ -629,11 +628,8 @@
 }
 
 bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
-  _dir = opendir("/proc");
-  _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct dirent) + _PC_NAME_MAX + 1, mtInternal);
-  if (NULL == _entry) {
-    return false;
-  }
+  _dir = os::opendir("/proc");
+  _entry = NULL;
   _valid = true;
   next_process();
 
@@ -641,12 +637,8 @@
 }
 
 SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() {
-  if (_entry != NULL) {
-    FREE_C_HEAP_ARRAY(char, _entry);
-  }
-
   if (_dir != NULL) {
-    closedir(_dir);
+    os::closedir(_dir);
   }
 }
 
--- a/src/hotspot/os/solaris/os_solaris.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -4308,9 +4308,7 @@
 
   // Scan the directory
   bool result = true;
-  char buf[sizeof(struct dirent) + MAX_PATH];
-  struct dirent *dbuf = (struct dirent *) buf;
-  while (result && (ptr = readdir(dir, dbuf)) != NULL) {
+  while (result && (ptr = readdir(dir)) != NULL) {
     if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
       result = false;
     }
--- a/src/hotspot/os/solaris/os_solaris.inline.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/solaris/os_solaris.inline.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -68,34 +68,6 @@
 
 inline const int os::default_file_open_flags() { return 0;}
 
-inline DIR* os::opendir(const char* dirname) {
-  assert(dirname != NULL, "just checking");
-  return ::opendir(dirname);
-}
-
-inline int os::readdir_buf_size(const char *path) {
-  int size = pathconf(path, _PC_NAME_MAX);
-  return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1;
-}
-
-inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) {
-  assert(dirp != NULL, "just checking");
-  dirent* p;
-  int status;
-
-  if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
-    errno = status;
-    return NULL;
-  } else {
-    return p;
-  }
-}
-
-inline int os::closedir(DIR *dirp) {
-  assert(dirp != NULL, "argument is NULL");
-  return ::closedir(dirp);
-}
-
 //////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 
--- a/src/hotspot/os/solaris/perfMemory_solaris.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/solaris/perfMemory_solaris.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -523,9 +523,8 @@
   // to determine the user name for the process id.
   //
   struct dirent* dentry;
-  char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
   errno = 0;
-  while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
+  while ((dentry = os::readdir(tmpdirp)) != NULL) {
 
     // check if the directory entry is a hsperfdata file
     if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) {
@@ -559,9 +558,8 @@
     }
 
     struct dirent* udentry;
-    char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
-    while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
+    while ((udentry = os::readdir(subdirp)) != NULL) {
 
       if (filename_to_pid(udentry->d_name) == vmid) {
         struct stat statbuf;
@@ -605,11 +603,9 @@
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf);
     FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -736,10 +732,8 @@
   // opendir/readdir.
   //
   struct dirent* entry;
-  char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
-
   errno = 0;
-  while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
+  while ((entry = os::readdir(dirp)) != NULL) {
 
     pid_t pid = filename_to_pid(entry->d_name);
 
@@ -778,8 +772,6 @@
 
   // close the directory and reset the current working directory
   close_directory_secure_cwd(dirp, saved_cwd_fd);
-
-  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
--- a/src/hotspot/os/windows/os_windows.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/windows/os_windows.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -1170,11 +1170,10 @@
   return dirp;
 }
 
-// parameter dbuf unused on Windows
-struct dirent * os::readdir(DIR *dirp, dirent *dbuf) {
+struct dirent * os::readdir(DIR *dirp) {
   assert(dirp != NULL, "just checking");      // hotspot change
   if (dirp->handle == INVALID_HANDLE_VALUE) {
-    return 0;
+    return NULL;
   }
 
   strcpy(dirp->dirent.d_name, dirp->find_data.cFileName);
@@ -1182,7 +1181,7 @@
   if (!FindNextFile(dirp->handle, &dirp->find_data)) {
     if (GetLastError() == ERROR_INVALID_HANDLE) {
       errno = EBADF;
-      return 0;
+      return NULL;
     }
     FindClose(dirp->handle);
     dirp->handle = INVALID_HANDLE_VALUE;
--- a/src/hotspot/os/windows/os_windows.inline.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/windows/os_windows.inline.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -57,14 +57,6 @@
   return true;
 }
 
-inline int os::readdir_buf_size(const char *path)
-{
-  /* As Windows doesn't use the directory entry buffer passed to
-     os::readdir() this can be as short as possible */
-
-  return 1;
-}
-
 // Bang the shadow pages if they need to be touched to be mapped.
 inline void os::map_stack_shadow_pages(address sp) {
   // Write to each page of our new frame to force OS mapping.
--- a/src/hotspot/os/windows/perfMemory_windows.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/os/windows/perfMemory_windows.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -318,9 +318,8 @@
   // to determine the user name for the process id.
   //
   struct dirent* dentry;
-  char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
   errno = 0;
-  while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
+  while ((dentry = os::readdir(tmpdirp)) != NULL) {
 
     // check if the directory entry is a hsperfdata file
     if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) {
@@ -353,9 +352,8 @@
     }
 
     struct dirent* udentry;
-    char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
-    while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
+    while ((udentry = os::readdir(subdirp)) != NULL) {
 
       if (filename_to_pid(udentry->d_name) == vmid) {
         struct stat statbuf;
@@ -407,11 +405,9 @@
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf);
     FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(latest_user);
 }
@@ -642,9 +638,8 @@
   // opendir/readdir.
   //
   struct dirent* entry;
-  char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
   errno = 0;
-  while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
+  while ((entry = os::readdir(dirp)) != NULL) {
 
     int pid = filename_to_pid(entry->d_name);
 
@@ -685,7 +680,6 @@
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // create a file mapping object with the requested name, and size
--- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -241,11 +241,7 @@
       return;
     }
     struct dirent* dentry;
-    char* dir_buffer = NEW_RESOURCE_ARRAY_RETURN_NULL(char, os::readdir_buf_size(_repo));
-    if (dir_buffer == NULL) {
-      return;
-    }
-    while ((dentry = os::readdir(dirp, (struct dirent*)dir_buffer)) != NULL) {
+    while ((dentry = os::readdir(dirp)) != NULL) {
       const char* const entry_path = filter(dentry->d_name);
       if (NULL != entry_path) {
         _files->append(entry_path);
--- a/src/hotspot/share/runtime/arguments.cpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jul 19 11:37:18 2018 -0400
@@ -561,7 +561,6 @@
   { "SharedMiscDataSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedMiscCodeSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "UseUTCFileTimestamp",           JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
-  { "UseAppCDS",                     JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "InlineNotify",                  JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "EnableTracing",                 JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "UseLockedTracing",              JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
@@ -1274,13 +1273,9 @@
     char stripped_argname[BUFLEN+1]; // +1 for '\0'
     jio_snprintf(stripped_argname, arg_len+1, "%s", argname); // +1 for '\0'
     if (is_obsolete_flag(stripped_argname, &since)) {
-      if (strcmp(stripped_argname, "UseAppCDS") != 0) {
-        char version[256];
-        since.to_string(version, sizeof(version));
-        warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
-      } else {
-        warning("Ignoring obsolete option UseAppCDS; AppCDS is automatically enabled");
-      }
+      char version[256];
+      since.to_string(version, sizeof(version));
+      warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
       return true;
     }
 #ifndef PRODUCT
--- a/src/hotspot/share/runtime/os.hpp	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/hotspot/share/runtime/os.hpp	Thu Jul 19 11:37:18 2018 -0400
@@ -580,8 +580,7 @@
 
   // Reading directories.
   static DIR*           opendir(const char* dirname);
-  static int            readdir_buf_size(const char *path);
-  static struct dirent* readdir(DIR* dirp, dirent* dbuf);
+  static struct dirent* readdir(DIR* dirp);
   static int            closedir(DIR* dirp);
 
   // Dynamic library extension
--- a/src/java.base/share/classes/java/lang/ProcessBuilder.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/ProcessBuilder.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1157,12 +1157,12 @@
      * are forcibly destroyed.
      * <p>
      * The {@code startPipeline} method performs the same checks on
-     * each ProcessBuilder as does the {@link #start} method. The new process
-     * will invoke the command and arguments given by {@link #command()},
-     * in a working directory as given by {@link #directory()},
-     * with a process environment as given by {@link #environment()}.
+     * each ProcessBuilder as does the {@link #start} method. Each new process
+     * invokes the command and arguments given by the respective process builder's
+     * {@link #command()}, in a working directory as given by its {@link #directory()},
+     * with a process environment as given by its {@link #environment()}.
      * <p>
-     * This method checks that the command is a valid operating
+     * Each process builder's command is checked to be a valid operating
      * system command.  Which commands are valid is system-dependent,
      * but at the very least the command must be a non-empty list of
      * non-null strings.
@@ -1174,7 +1174,7 @@
      * <p>
      * If there is a security manager, its
      * {@link SecurityManager#checkExec checkExec}
-     * method is called with the first component of this object's
+     * method is called with the first component of each process builder's
      * {@code command} array as its argument. This may result in
      * a {@link SecurityException} being thrown.
      * <p>
@@ -1194,8 +1194,8 @@
      * If the operating system does not support the creation of
      * processes, an {@link UnsupportedOperationException} will be thrown.
      * <p>
-     * Subsequent modifications to this process builder will not
-     * affect the returned {@link Process}.
+     * Subsequent modifications to any of the specified builders
+     * will not affect the returned {@link Process}.
      * @apiNote
      * For example to count the unique imports for all the files in a file hierarchy
      * on a Unix compatible platform:
--- a/src/java.base/share/classes/java/time/temporal/JulianFields.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/share/classes/java/time/temporal/JulianFields.java	Thu Jul 19 11:37:18 2018 -0400
@@ -222,8 +222,6 @@
         MODIFIED_JULIAN_DAY("ModifiedJulianDay", DAYS, FOREVER, 40587L),
         RATA_DIE("RataDie", DAYS, FOREVER, 719163L);
 
-        private static final long serialVersionUID = -7501623920830201812L;
-
         private final transient String name;
         private final transient TemporalUnit baseUnit;
         private final transient TemporalUnit rangeUnit;
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,19 +65,21 @@
  * interface or class. A {@code ServiceLoader} is an object that locates and
  * loads service providers deployed in the run time environment at a time of an
  * application's choosing. Application code refers only to the service, not to
- * service providers, and is assumed to be capable of differentiating between
- * multiple service providers as well as handling the possibility that no service
- * providers are located.
+ * service providers, and is assumed to be capable of choosing between multiple
+ * service providers (based on the functionality they expose through the service),
+ * and handling the possibility that no service providers are located.
  *
  * <h3> Obtaining a service loader </h3>
  *
  * <p> An application obtains a service loader for a given service by invoking
- * one of the static {@code load} methods of ServiceLoader. If the application
- * is a module, then its module declaration must have a <i>uses</i> directive
- * that specifies the service; this helps to locate providers and ensure they
- * will execute reliably. In addition, if the service is not in the application
- * module, then the module declaration must have a <i>requires</i> directive
- * that specifies the module which exports the service.
+ * one of the static {@code load} methods of {@code ServiceLoader}. If the
+ * application is a module, then its module declaration must have a <i>uses</i>
+ * directive that specifies the service; this helps to locate providers and ensure
+ * they will execute reliably. In addition, if the application module does not
+ * contain the service, then its module declaration must have a <i>requires</i>
+ * directive that specifies the module which exports the service. It is strongly
+ * recommended that the application module does <b>not</b> require modules which
+ * contain providers of the service.
  *
  * <p> A service loader can be used to locate and instantiate providers of the
  * service by means of the {@link #iterator() iterator} method. {@code ServiceLoader}
--- a/src/java.base/share/classes/java/util/jar/JarVerifier.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java	Thu Jul 19 11:37:18 2018 -0400
@@ -437,7 +437,7 @@
                        InputStream is,
                        JarVerifier jv) throws IOException
         {
-            this.is = is;
+            this.is = Objects.requireNonNull(is);
             this.jv = jv;
             this.mev = new ManifestEntryVerifier(man);
             this.jv.beginEntry(je, mev);
@@ -448,6 +448,7 @@
 
         public int read() throws IOException
         {
+            ensureOpen();
             if (numLeft > 0) {
                 int b = is.read();
                 jv.update(b, mev);
@@ -461,6 +462,7 @@
         }
 
         public int read(byte b[], int off, int len) throws IOException {
+            ensureOpen();
             if ((numLeft > 0) && (numLeft < len)) {
                 len = (int)numLeft;
             }
@@ -488,9 +490,15 @@
         }
 
         public int available() throws IOException {
+            ensureOpen();
             return is.available();
         }
 
+        private void ensureOpen() throws IOException {
+            if (is == null) {
+                throw new IOException("stream closed");
+            }
+        }
     }
 
     // Extended JavaUtilJarAccess CodeSource API Support
--- a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java	Thu Jul 19 11:37:18 2018 -0400
@@ -891,9 +891,10 @@
 
         List<CipherSuite> cipherSuites = new ArrayList<>(names.length);
         for (String name : names) {
-            if (name == null) {
+            if (name == null || name.isEmpty()) {
                 throw new IllegalArgumentException(
-                    "The specified CipherSuites array contain null element");
+                        "The specified CipherSuites array contains " +
+                        "invalid null or empty string elements");
             }
 
             boolean found = false;
--- a/src/java.base/unix/native/libjava/TimeZone_md.c	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
 
 #if defined(_ALLBSD_SOURCE)
 #define dirent64 dirent
-#define readdir64_r readdir_r
+#define readdir64 readdir
 #endif
 
 #if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
@@ -122,32 +122,18 @@
     DIR *dirp = NULL;
     struct stat statbuf;
     struct dirent64 *dp = NULL;
-    struct dirent64 *entry = NULL;
     char *pathname = NULL;
     int fd = -1;
     char *dbuf = NULL;
     char *tz = NULL;
     int res;
-    long name_max = 0;
 
     dirp = opendir(dir);
     if (dirp == NULL) {
         return NULL;
     }
 
-    name_max = pathconf(dir, _PC_NAME_MAX);
-    // If pathconf did not work, fall back to a mimimum buffer size.
-    if (name_max < 1024) {
-        name_max = 1024;
-    }
-
-    entry = (struct dirent64 *)malloc(offsetof(struct dirent64, d_name) + name_max + 1);
-    if (entry == NULL) {
-        (void) closedir(dirp);
-        return NULL;
-    }
-
-    while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
+    while ((dp = readdir64(dirp)) != NULL) {
         /*
          * Skip '.' and '..' (and possibly other .* files)
          */
@@ -214,9 +200,6 @@
         pathname = NULL;
     }
 
-    if (entry != NULL) {
-        free((void *) entry);
-    }
     if (dirp != NULL) {
         (void) closedir(dirp);
     }
--- a/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
 
 #if defined(_ALLBSD_SOURCE)
   #define dirent64 dirent
-  #define readdir64_r readdir_r
+  #define readdir64 readdir
   #define stat64 stat
   #ifndef MACOSX
     #define statvfs64 statvfs
@@ -312,7 +312,6 @@
 {
     DIR *dir = NULL;
     struct dirent64 *ptr;
-    struct dirent64 *result;
     int len, maxlen;
     jobjectArray rv, old;
     jclass str_class;
@@ -325,13 +324,6 @@
     } END_PLATFORM_STRING(env, path);
     if (dir == NULL) return NULL;
 
-    ptr = malloc(sizeof(struct dirent64) + (PATH_MAX + 1));
-    if (ptr == NULL) {
-        JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
-        closedir(dir);
-        return NULL;
-    }
-
     /* Allocate an initial String array */
     len = 0;
     maxlen = 16;
@@ -339,7 +331,7 @@
     if (rv == NULL) goto error;
 
     /* Scan the directory */
-    while ((readdir64_r(dir, ptr, &result) == 0)  && (result != NULL)) {
+    while ((ptr = readdir64(dir)) != NULL) {
         jstring name;
         if (!strcmp(ptr->d_name, ".") || !strcmp(ptr->d_name, ".."))
             continue;
@@ -360,7 +352,6 @@
         (*env)->DeleteLocalRef(env, name);
     }
     closedir(dir);
-    free(ptr);
 
     /* Copy the final results into an appropriately-sized array */
     old = rv;
@@ -375,7 +366,6 @@
 
  error:
     closedir(dir);
-    free(ptr);
     return NULL;
 }
 
--- a/src/java.base/windows/native/libjava/WinNTFileSystem_md.c	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.base/windows/native/libjava/WinNTFileSystem_md.c	Thu Jul 19 11:37:18 2018 -0400
@@ -639,6 +639,7 @@
     jstring name;
     jclass str_class;
     WCHAR *pathbuf;
+    DWORD err;
 
     str_class = JNU_ClassString(env);
     CHECK_NULL_RETURN(str_class, NULL);
@@ -700,8 +701,10 @@
     len = 0;
     maxlen = 16;
     rv = (*env)->NewObjectArray(env, maxlen, str_class, NULL);
-    if (rv == NULL) // Couldn't allocate an array
+    if (rv == NULL) { // Couldn't allocate an array
+        FindClose(handle);
         return NULL;
+    }
     /* Scan the directory */
     do {
         if (!wcscmp(find_data.cFileName, L".")
@@ -709,13 +712,17 @@
            continue;
         name = (*env)->NewString(env, find_data.cFileName,
                                  (jsize)wcslen(find_data.cFileName));
-        if (name == NULL)
-            return NULL; // error;
+        if (name == NULL) {
+            FindClose(handle);
+            return NULL; // error
+        }
         if (len == maxlen) {
             old = rv;
             rv = (*env)->NewObjectArray(env, maxlen <<= 1, str_class, NULL);
-            if (rv == NULL || JNU_CopyObjectArray(env, rv, old, len) < 0)
+            if (rv == NULL || JNU_CopyObjectArray(env, rv, old, len) < 0) {
+                FindClose(handle);
                 return NULL; // error
+            }
             (*env)->DeleteLocalRef(env, old);
         }
         (*env)->SetObjectArrayElement(env, rv, len++, name);
@@ -723,9 +730,11 @@
 
     } while (FindNextFileW(handle, &find_data));
 
-    if (GetLastError() != ERROR_NO_MORE_FILES)
+    err = GetLastError();
+    FindClose(handle);
+    if (err != ERROR_NO_MORE_FILES) {
         return NULL; // error
-    FindClose(handle);
+    }
 
     if (len < maxlen) {
         /* Copy the final results into an appropriately-sized array */
--- a/src/java.desktop/share/classes/java/awt/Font.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.desktop/share/classes/java/awt/Font.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1895,8 +1895,7 @@
      * @see #readObject(java.io.ObjectInputStream)
      */
     private void writeObject(java.io.ObjectOutputStream s)
-      throws java.lang.ClassNotFoundException,
-             java.io.IOException
+      throws java.io.IOException
     {
         if (values != null) {
           synchronized(values) {
--- a/src/java.desktop/share/classes/java/awt/MenuBar.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.desktop/share/classes/java/awt/MenuBar.java	Thu Jul 19 11:37:18 2018 -0400
@@ -432,8 +432,7 @@
      * @see #readObject(java.io.ObjectInputStream)
      */
     private void writeObject(java.io.ObjectOutputStream s)
-      throws java.lang.ClassNotFoundException,
-             java.io.IOException
+      throws java.io.IOException
     {
       s.defaultWriteObject();
     }
--- a/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.desktop/share/classes/java/awt/font/TransformAttribute.java	Thu Jul 19 11:37:18 2018 -0400
@@ -100,8 +100,7 @@
     public static final TransformAttribute IDENTITY = new TransformAttribute(null);
 
     private void writeObject(java.io.ObjectOutputStream s)
-      throws java.lang.ClassNotFoundException,
-             java.io.IOException
+      throws java.io.IOException
     {
         // sigh -- 1.3 expects transform is never null, so we need to always write one out
         if (this.transform == null) {
--- a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java	Thu Jul 19 11:37:18 2018 -0400
@@ -3943,7 +3943,7 @@
     private static final long serialVersionUID = 1330973210523860834L;
 
     private void writeObject(java.io.ObjectOutputStream s)
-        throws java.lang.ClassNotFoundException, java.io.IOException
+        throws java.io.IOException
     {
         s.defaultWriteObject();
     }
--- a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java	Thu Jul 19 11:37:18 2018 -0400
@@ -998,7 +998,7 @@
      * @param oos the ObjectOutputStream
      */
 
-    private synchronized void writeObject(ObjectOutputStream oos) throws IOException, ClassNotFoundException {
+    private synchronized void writeObject(ObjectOutputStream oos) throws IOException {
         serializing = true;
 
         synchronized (BeanContext.globalHierarchyLock) {
--- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c	Tue Jul 17 11:05:06 2018 -0400
+++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,19 +74,10 @@
 
 #endif /* _ALLBSD_SOURCE */
 
-static struct dirent* read_dir(DIR* dirp, struct dirent* entry) {
-#ifdef __solaris__
-    struct dirent* dbuf = readdir(dirp);
-    return dbuf;
-#else /* __linux__ || _ALLBSD_SOURCE */
-    struct dirent* p;
-    if (readdir_r(dirp, entry, &p) == 0) {
-        return p;
-    } else {
-        return NULL;
-    }
+#if defined(_ALLBSD_SOURCE)
+  #define dirent64 dirent
+  #define readdir64 readdir
 #endif
-}
 
 // true = get available swap in bytes
 // false = get total swap in bytes
@@ -432,8 +423,7 @@
     return (100);
 #else /* solaris/linux */
     DIR *dirp;
-    struct dirent dbuf;
-    struct dirent* dentp;
+    struct dirent64* dentp;
     jlong fds = 0;
 
 #if defined(_AIX)
@@ -453,7 +443,7 @@
 
     // iterate through directory entries, skipping '.' and '..'
     // each entry represents an open file descriptor.
-    while ((dentp = read_dir(dirp, &dbuf)) != NULL) {
+    while ((dentp = readdir64(dirp)) != NULL) {
         if (isdigit(dentp->d_name[0])) {
             fds++;
         }
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java	Thu Jul 19 11:37:18 2018 -0400
@@ -71,8 +71,6 @@
                 "Class data sharing is inconsistent with other specified options", 1) );
             testTable.add( new TestVector("-XX:+UseCompressedClassPointers", "-XX:-UseCompressedClassPointers",
                 "Class data sharing is inconsistent with other specified options", 1) );
-            testTable.add( new TestVector("-XX:-UseAppCDS", "-XX:+UseAppCDS",
-                "Ignoring obsolete option UseAppCDS; AppCDS is automatically enabled", 0) );
         }
     }
 
--- a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java	Tue Jul 17 11:05:06 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @summary Try different combination of mismatched UseAppCDS between dump time and run time.
- * @requires vm.cds
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- *          java.management
- *          jdk.jartool/sun.tools.jar
- * @compile test-classes/CheckIfShared.java
- * @build sun.hotspot.WhiteBox
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main MismatchedUseAppCDS
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class MismatchedUseAppCDS {
-  public static void main(String[] args) throws Exception {
-    String wbJar = JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");
-    String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar;
-
-    String appJar = JarBuilder.build("MismatchedUseAppCDS", "CheckIfShared");
-
-    OutputAnalyzer output;
-
-    // (1): dump with -XX:+UseAppCDS, but run with -XX:-UseAppCDS
-    TestCommon.testDump(appJar, TestCommon.list("CheckIfShared"),
-                        // command-line arguments ...
-                        "-XX:+UseAppCDS",
-                        use_whitebox_jar);
-
-    output = TestCommon.exec(appJar,
-                             // command-line arguments ...
-                             use_whitebox_jar,
-                             "-XX:-UseAppCDS",
-                             "-XX:+UnlockDiagnosticVMOptions",
-                             "-XX:+WhiteBoxAPI",
-                             "CheckIfShared", "true");
-    TestCommon.checkExec(output);
-
-    // (2): dump with -XX:-UseAppCDS, but run with -XX:+UseAppCDS
-    TestCommon.testDump(appJar, TestCommon.list("CheckIfShared"),
-                        // command-line arguments ...
-                        "-XX:-UseAppCDS",
-                        use_whitebox_jar);
-
-    output = TestCommon.exec(appJar,
-                             // command-line arguments ...
-                             use_whitebox_jar,
-                             "-XX:+UseAppCDS",
-                             "-XX:+UnlockDiagnosticVMOptions",
-                             "-XX:+WhiteBoxAPI",
-                             "CheckIfShared", "true");
-    TestCommon.checkExec(output);
-  }
-}
--- a/test/hotspot/jtreg/runtime/appcds/test-classes/CheckIfShared.java	Tue Jul 17 11:05:06 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-import sun.hotspot.WhiteBox;
-
-public class CheckIfShared {
-  public static void main(String args[]) throws Exception {
-    WhiteBox wb = WhiteBox.getWhiteBox();
-    if ("true".equals(args[0])) {
-      if (!wb.isSharedClass(CheckIfShared.class)) {
-        throw new RuntimeException("wb.isSharedClass(CheckIfShared.class) should be true");
-      }
-    } else {
-      if (wb.isSharedClass(CheckIfShared.class)) {
-        throw new RuntimeException("wb.isSharedClass(CheckIfShared.class) should be false");
-      }
-    }
-  }
-}
--- a/test/jdk/ProblemList.txt	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/ProblemList.txt	Thu Jul 19 11:37:18 2018 -0400
@@ -873,4 +873,3 @@
 
 jdk/jfr/event/io/TestInstrumentation.java                       8202142    generic-all
 jdk/jfr/event/sampling/TestNative.java                          8202142    generic-all
-jdk/jfr/event/os/TestSystemProcess.java                         8202835    linux-all
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/CloseTest.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/CloseTest.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 
+import jdk.test.lib.Utils;
+
 public class CloseTest {
 
     public static void main(String args[]) throws Exception {
@@ -50,7 +52,7 @@
 
         String service_args[] = new String[2];
         service_args[0] = String.valueOf(msg.length());
-        service_args[1] = String.valueOf( 15*1000 );
+        service_args[1] = String.valueOf( Utils.adjustTimeout(15*1000) );
 
 
         SocketChannel sc = Launcher.launchWithSocketChannel("EchoService", service_args);
@@ -65,7 +67,7 @@
         Selector sel = sc.provider().openSelector();
         SelectionKey sk = sc.register(sel, SelectionKey.OP_READ);
 
-        long to = 12 * 1000;
+        long to = Utils.adjustTimeout(12*1000);
         for (;;) {
             long st = System.currentTimeMillis();
             sel.select(to);
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoService.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoService.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,8 @@
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 
+import jdk.test.lib.Utils;
+
 public class EchoService {
 
     private static void doIt(SocketChannel sc, int closeAfter, int delay) throws IOException {
@@ -173,7 +175,7 @@
             SocketChannel sc;
             int count = 0;
             for (;;) {
-                 sel.select(5000);
+                 sel.select((int)Utils.adjustTimeout(5000));
                  if (sk.isAcceptable() && ((sc = ssc.accept()) != null)) {
                     Worker w = new Worker(sc);
                     (new Thread(w)).start();
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,8 @@
 import java.nio.channels.SocketChannel;
 import java.util.Random;
 
+import jdk.test.lib.Utils;
+
 public class EchoTest {
 
     private static int failures = 0;
@@ -80,7 +82,7 @@
         Selector sel = sc.provider().openSelector();
         SelectionKey sk = sc.register(sel, SelectionKey.OP_READ);
         int nread = 0;
-        long to = 5000;
+        long to = Utils.adjustTimeout(5000);
         while (nread < size) {
             long st = System.currentTimeMillis();
             sel.select(to);
@@ -144,7 +146,7 @@
         // and receive the echo
         byte b[] = new byte[msg.length() + 100];
         DatagramPacket pkt2 = new DatagramPacket(b, b.length);
-        dc.socket().setSoTimeout(5000);
+        dc.socket().setSoTimeout((int)Utils.adjustTimeout(5000));
         dc.socket().receive(pkt2);
 
         if (pkt2.getLength() != msg.length()) {
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java	Thu Jul 19 11:37:18 2018 -0400
@@ -57,7 +57,7 @@
 public class InheritedChannelTest {
 
     private static final String TEST_SRC = System.getProperty("test.src");
-    private static final String TEST_CLASSES = System.getProperty("test.classes");
+    private static final String TEST_CLASSES = System.getProperty("test.class.path");
     private static final Path POLICY_PASS = Paths.get(TEST_SRC, "java.policy.pass");
     private static final Path POLICY_FAIL = Paths.get(TEST_SRC, "java.policy.fail");
 
--- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTest.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTest.java	Thu Jul 19 11:37:18 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 
+import jdk.test.lib.Utils;
+
 public class StateTest {
 
     private static int failures = 0;
@@ -66,7 +68,7 @@
          */
         ssc.configureBlocking(false);
         sk = ssc.register(sel, SelectionKey.OP_ACCEPT);
-        long to = 15*1000;
+        long to = Utils.adjustTimeout(15*1000);
         sc = null;
         for (;;) {
             long st = System.currentTimeMillis();
@@ -89,7 +91,7 @@
          */
         sc.configureBlocking(false);
         sk = sc.register(sel, SelectionKey.OP_READ);
-        to = 5000;
+        to = Utils.adjustTimeout(5000);
         ByteBuffer bb = ByteBuffer.allocateDirect(20);
         for (;;) {
             long st = System.currentTimeMillis();
--- a/test/jdk/java/util/jar/JarFile/SignedJarFileGetInputStream.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/java/util/jar/JarFile/SignedJarFileGetInputStream.java	Thu Jul 19 11:37:18 2018 -0400
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4845692
+ * @bug 4845692 8206863
  * @summary JarFile.getInputStream should not throw when jar file is signed
  * @author Martin Buchholz
  */
@@ -42,5 +42,27 @@
             InputStream is = jar.getInputStream(new ZipEntry(entry.getName()));
             is.close();
         }
+
+        // read(), available() on closed stream should throw IOException
+        InputStream is = jar.getInputStream(new ZipEntry("Test.class"));
+        is.close();
+        byte[] buffer = new byte[1];
+
+        try {
+            is.read();
+            throw new AssertionError("Should have thrown IOException");
+        } catch (IOException success) {}
+        try {
+            is.read(buffer);
+            throw new AssertionError("Should have thrown IOException");
+        } catch (IOException success) {}
+        try {
+            is.read(buffer, 0, buffer.length);
+            throw new AssertionError("Should have thrown IOException");
+        } catch (IOException success) {}
+        try {
+            is.available();
+            throw new AssertionError("Should have thrown IOException");
+        } catch (IOException success) {}
     }
 }
--- a/test/jdk/lib/security/cacerts/VerifyCACerts.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/jdk/lib/security/cacerts/VerifyCACerts.java	Thu Jul 19 11:37:18 2018 -0400
@@ -25,7 +25,6 @@
 /**
  * @test
  * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
- * @requires java.runtime.name ~= "OpenJDK.*"
  * @summary Check root CA entries in cacerts file
  */
 import java.io.File;
--- a/test/lib/jdk/test/lib/util/FileUtils.java	Tue Jul 17 11:05:06 2018 -0400
+++ b/test/lib/jdk/test/lib/util/FileUtils.java	Thu Jul 19 11:37:18 2018 -0400
@@ -39,6 +39,7 @@
 import java.nio.file.attribute.BasicFileAttributes;
 import java.time.Instant;
 import java.time.Duration;
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.ArrayDeque;
 import java.util.HashSet;
@@ -242,16 +243,15 @@
      * @throws UncheckedIOException if an error occurs
      */
     public static void listFileDescriptors(PrintStream ps) {
-        List<String> lsofDirs = List.of("/usr/bin", "/usr/sbin");
-        Optional<Path> lsof = lsofDirs.stream()
-                .map(s -> Paths.get(s, "lsof"))
-                .filter(f -> Files.isExecutable(f))
+
+        Optional<String[]> lsof = Arrays.stream(lsCommands)
+                .filter(args -> Files.isExecutable(Path.of(args[0])))
                 .findFirst();
-        lsof.ifPresent(exe -> {
+        lsof.ifPresent(args -> {
             try {
                 ps.printf("Open File Descriptors:%n");
                 long pid = ProcessHandle.current().pid();
-                ProcessBuilder pb = new ProcessBuilder(exe.toString(), "-p", Integer.toString((int) pid));
+                ProcessBuilder pb = new ProcessBuilder(args[0], args[1], Integer.toString((int) pid));
                 pb.redirectErrorStream(true);   // combine stderr and stdout
                 pb.redirectOutput(Redirect.PIPE);
 
@@ -273,4 +273,14 @@
             }
         });
     }
+
+    // Possible command locations and arguments
+    static String[][] lsCommands = new String[][] {
+            {"/usr/bin/lsof", "-p"},
+            {"/usr/sbin/lsof", "-p"},
+            {"/bin/lsof", "-p"},
+            {"/sbin/lsof", "-p"},
+            {"/usr/local/bin/lsof", "-p"},
+            {"/usr/bin/pfiles", "-F"},   // Solaris
+    };
 }