# HG changeset patch # User clanger # Date 1470062033 -7200 # Mon Aug 01 16:33:53 2016 +0200 # Node ID 0a68771439e0eb8a50521e54587fd17302e9e99e # Parent 2e21095f80c611b7ec2d90d246b8d082718aa772 8162869: Small fixes for AIX perf memory and attach listener diff --git a/src/os/aix/vm/attachListener_aix.cpp b/src/os/aix/vm/attachListener_aix.cpp --- a/src/os/aix/vm/attachListener_aix.cpp +++ b/src/os/aix/vm/attachListener_aix.cpp @@ -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 { diff --git a/src/os/aix/vm/perfMemory_aix.cpp b/src/os/aix/vm/perfMemory_aix.cpp --- a/src/os/aix/vm/perfMemory_aix.cpp +++ b/src/os/aix/vm/perfMemory_aix.cpp @@ -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) { diff --git a/src/os/bsd/vm/perfMemory_bsd.cpp b/src/os/bsd/vm/perfMemory_bsd.cpp --- a/src/os/bsd/vm/perfMemory_bsd.cpp +++ b/src/os/bsd/vm/perfMemory_bsd.cpp @@ -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 diff --git a/src/os/linux/vm/perfMemory_linux.cpp b/src/os/linux/vm/perfMemory_linux.cpp --- a/src/os/linux/vm/perfMemory_linux.cpp +++ b/src/os/linux/vm/perfMemory_linux.cpp @@ -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) { diff --git a/src/os/solaris/vm/perfMemory_solaris.cpp b/src/os/solaris/vm/perfMemory_solaris.cpp --- a/src/os/solaris/vm/perfMemory_solaris.cpp +++ b/src/os/solaris/vm/perfMemory_solaris.cpp @@ -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