8162869: Small fixes for AIX perf memory and attach listener

Reviewed-by: dsamersoff, dholmes
This commit is contained in:
Christoph Langer 2016-08-01 20:41:15 -04:00
parent 8f37b6e451
commit b0c36d35ed
5 changed files with 27 additions and 26 deletions

View file

@ -383,23 +383,20 @@ AixAttachOperation* AixAttachListener::dequeue() {
struct peercred_struct cred_info; struct peercred_struct cred_info;
socklen_t optlen = sizeof(cred_info); socklen_t optlen = sizeof(cred_info);
if (::getsockopt(s, SOL_SOCKET, SO_PEERID, (void*)&cred_info, &optlen) == -1) { if (::getsockopt(s, SOL_SOCKET, SO_PEERID, (void*)&cred_info, &optlen) == -1) {
int res; ::close(s);
RESTARTABLE(::close(s), res);
continue; continue;
} }
uid_t euid = geteuid(); uid_t euid = geteuid();
gid_t egid = getegid(); gid_t egid = getegid();
if (cred_info.euid != euid || cred_info.egid != egid) { if (cred_info.euid != euid || cred_info.egid != egid) {
int res; ::close(s);
RESTARTABLE(::close(s), res);
continue; continue;
} }
// peer credential look okay so we read the request // peer credential look okay so we read the request
AixAttachOperation* op = read_request(s); AixAttachOperation* op = read_request(s);
if (op == NULL) { if (op == NULL) {
int res;
::close(s); ::close(s);
continue; continue;
} else { } else {

View file

@ -951,25 +951,24 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// open the file // open the file
int result; int result;
// No O_NOFOLLOW defined at buildtime, and it is not documented for open; // provide a workaround in case no O_NOFOLLOW is defined at buildtime
// so provide a workaround in this case
#ifdef O_NOFOLLOW #ifdef O_NOFOLLOW
RESTARTABLE(::open(filename, oflags), result); RESTARTABLE(::open(filename, oflags), result);
#else #else
result = open_o_nofollow(filename, oflags); result = open_o_nofollow(filename, oflags);
#endif #endif
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied"); "Permission denied", OS_ERR);
} }
else { 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; int fd = result;
@ -987,7 +986,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// memory region on success or NULL on failure. A return value of // memory region on success or NULL on failure. A return value of
// NULL will ultimately disable the shared memory feature. // 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. // is the file system name space.
// //
// A monitoring application attaching to a JVM does not need to know // A monitoring application attaching to a JVM does not need to know
@ -1011,6 +1010,7 @@ static char* mmap_create_shared(size_t size) {
char* dirname = get_user_tmp_dir(user_name); char* dirname = get_user_tmp_dir(user_name);
char* filename = get_sharedmem_filename(dirname, vmid); char* filename = get_sharedmem_filename(dirname, vmid);
// get the short filename. // get the short filename.
char* short_filename = strrchr(filename, '/'); char* short_filename = strrchr(filename, '/');
if (short_filename == NULL) { if (short_filename == NULL) {

View file

@ -881,14 +881,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found", OS_ERR); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied", OS_ERR); "Permission denied", OS_ERR);
} }
else { 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; int fd = result;
@ -906,7 +907,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// memory region on success or NULL on failure. A return value of // memory region on success or NULL on failure. A return value of
// NULL will ultimately disable the shared memory feature. // 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. // is the file system name space.
// //
// A monitoring application attaching to a JVM does not need to know // A monitoring application attaching to a JVM does not need to know

View file

@ -891,14 +891,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found", OS_ERR); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied", OS_ERR); "Permission denied", OS_ERR);
} }
else { 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; int fd = result;
@ -916,7 +917,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// memory region on success or NULL on failure. A return value of // memory region on success or NULL on failure. A return value of
// NULL will ultimately disable the shared memory feature. // 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. // is the file system name space.
// //
// A monitoring application attaching to a JVM does not need to know // A monitoring application attaching to a JVM does not need to know
@ -940,6 +941,7 @@ static char* mmap_create_shared(size_t size) {
char* dirname = get_user_tmp_dir(user_name); char* dirname = get_user_tmp_dir(user_name);
char* filename = get_sharedmem_filename(dirname, vmid); char* filename = get_sharedmem_filename(dirname, vmid);
// get the short filename // get the short filename
char* short_filename = strrchr(filename, '/'); char* short_filename = strrchr(filename, '/');
if (short_filename == NULL) { if (short_filename == NULL) {

View file

@ -907,14 +907,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found", OS_ERR); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied", OS_ERR); "Permission denied", OS_ERR);
} }
else { 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; int fd = result;
@ -932,7 +933,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// memory region on success or NULL on failure. A return value of // memory region on success or NULL on failure. A return value of
// NULL will ultimately disable the shared memory feature. // 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. // is the file system name space.
// //
// A monitoring application attaching to a JVM does not need to know // A monitoring application attaching to a JVM does not need to know