changeset 11751:5ff3c0f8fb8b

8162869: Small fixes for AIX perf memory and attach listener Reviewed-by: dsamersoff, dholmes
author clanger
date Mon, 01 Aug 2016 20:41:15 -0400
parents 02527f3cfc5d
children 8434f901a207
files src/os/aix/vm/attachListener_aix.cpp src/os/aix/vm/perfMemory_aix.cpp src/os/bsd/vm/perfMemory_bsd.cpp src/os/linux/vm/perfMemory_linux.cpp src/os/solaris/vm/perfMemory_solaris.cpp
diffstat 5 files changed, 27 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/aix/vm/attachListener_aix.cpp	Mon Aug 01 16:28:23 2016 -0400
+++ b/src/os/aix/vm/attachListener_aix.cpp	Mon Aug 01 20:41:15 2016 -0400
@@ -383,23 +383,20 @@
     struct peercred_struct cred_info;
     socklen_t optlen = sizeof(cred_info);
     if (::getsockopt(s, SOL_SOCKET, SO_PEERID, (void*)&cred_info, &optlen) == -1) {
-      int res;
-      RESTARTABLE(::close(s), res);
+      ::close(s);
       continue;
     }
     uid_t euid = geteuid();
     gid_t egid = getegid();
 
     if (cred_info.euid != euid || cred_info.egid != egid) {
-      int res;
-      RESTARTABLE(::close(s), res);
+      ::close(s);
       continue;
     }
 
     // peer credential look okay so we read the request
     AixAttachOperation* op = read_request(s);
     if (op == NULL) {
-      int res;
       ::close(s);
       continue;
     } else {
--- a/src/os/aix/vm/perfMemory_aix.cpp	Mon Aug 01 16:28:23 2016 -0400
+++ b/src/os/aix/vm/perfMemory_aix.cpp	Mon Aug 01 20:41:15 2016 -0400
@@ -951,25 +951,24 @@
 
   // open the file
   int result;
-  // No O_NOFOLLOW defined at buildtime, and it is not documented for open;
-  // so provide a workaround in this case
+  // provide a workaround in case no O_NOFOLLOW is defined at buildtime
 #ifdef O_NOFOLLOW
   RESTARTABLE(::open(filename, oflags), result);
 #else
   result = open_o_nofollow(filename, oflags);
 #endif
-
   if (result == OS_ERR) {
     if (errno == ENOENT) {
-      THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found");
+      THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
-      THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied");
+      THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_0(vmSymbols::java_io_IOException(), os::strerror(errno));
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -987,7 +986,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On AIX, Solaris and Linux, the name space for shared memory objects
+// On AIX, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
@@ -1011,6 +1010,7 @@
 
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
+
   // get the short filename.
   char* short_filename = strrchr(filename, '/');
   if (short_filename == NULL) {
--- a/src/os/bsd/vm/perfMemory_bsd.cpp	Mon Aug 01 16:28:23 2016 -0400
+++ b/src/os/bsd/vm/perfMemory_bsd.cpp	Mon Aug 01 20:41:15 2016 -0400
@@ -881,14 +881,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -906,7 +907,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Bsd, the name space for shared memory objects
+// On BSD, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
--- a/src/os/linux/vm/perfMemory_linux.cpp	Mon Aug 01 16:28:23 2016 -0400
+++ b/src/os/linux/vm/perfMemory_linux.cpp	Mon Aug 01 20:41:15 2016 -0400
@@ -891,14 +891,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -916,7 +917,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Linux, the name space for shared memory objects
+// On Linux, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know
@@ -940,6 +941,7 @@
 
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
+
   // get the short filename
   char* short_filename = strrchr(filename, '/');
   if (short_filename == NULL) {
--- a/src/os/solaris/vm/perfMemory_solaris.cpp	Mon Aug 01 16:28:23 2016 -0400
+++ b/src/os/solaris/vm/perfMemory_solaris.cpp	Mon Aug 01 20:41:15 2016 -0400
@@ -907,14 +907,15 @@
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Process not found", OS_ERR);
+                 "Process not found", OS_ERR);
     }
     else if (errno == EACCES) {
       THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
-                  "Permission denied", OS_ERR);
+                 "Permission denied", OS_ERR);
     }
     else {
-      THROW_MSG_(vmSymbols::java_io_IOException(), os::strerror(errno), OS_ERR);
+      THROW_MSG_(vmSymbols::java_io_IOException(),
+                 os::strerror(errno), OS_ERR);
     }
   }
   int fd = result;
@@ -932,7 +933,7 @@
 // memory region on success or NULL on failure. A return value of
 // NULL will ultimately disable the shared memory feature.
 //
-// On Solaris and Linux, the name space for shared memory objects
+// On Solaris, the name space for shared memory objects
 // is the file system name space.
 //
 // A monitoring application attaching to a JVM does not need to know