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;
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 {

View File

@ -951,25 +951,24 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// 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 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// 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 @@ static char* mmap_create_shared(size_t size) {
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) {

View File

@ -881,14 +881,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
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 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// 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

View File

@ -891,14 +891,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
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 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// 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 @@ static char* mmap_create_shared(size_t size) {
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) {

View File

@ -907,14 +907,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
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 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
// 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