# HG changeset patch # User rdurbin # Date 1371221182 25200 # Node ID e95fc50106cf0739bfe530b3dea5265c9c4dec63 # Parent a837fa3d3f869b0cd290fc49305f6de5ac794aa9 7178026: os::close can restart ::close but that is not a restartable syscall Summary: Removed restart macros from all os:close calls on Solaris, Linux, MacOS X platforms. Reviewed-by: dcubed, dholmes diff -r a837fa3d3f86 -r e95fc50106cf src/os/bsd/dtrace/jvm_dtrace.c --- a/src/os/bsd/dtrace/jvm_dtrace.c Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/bsd/dtrace/jvm_dtrace.c Fri Jun 14 07:46:22 2013 -0700 @@ -122,9 +122,7 @@ } static int file_close(int fd) { - int ret; - RESTARTABLE(close(fd), ret); - return ret; + return close(fd); } static int file_read(int fd, char* buf, int len) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/bsd/vm/attachListener_bsd.cpp --- a/src/os/bsd/vm/attachListener_bsd.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/bsd/vm/attachListener_bsd.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -199,7 +199,7 @@ ::unlink(initial_path); int res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr)); if (res == -1) { - RESTARTABLE(::close(listener), res); + ::close(listener); return -1; } @@ -217,7 +217,7 @@ } } if (res == -1) { - RESTARTABLE(::close(listener), res); + ::close(listener); ::unlink(initial_path); return -1; } @@ -345,24 +345,21 @@ uid_t puid; gid_t pgid; if (::getpeereid(s, &puid, &pgid) != 0) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } uid_t euid = geteuid(); gid_t egid = getegid(); if (puid != euid || pgid != egid) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } // peer credential look okay so we read the request BsdAttachOperation* op = read_request(s); if (op == NULL) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } else { return op; @@ -413,7 +410,7 @@ } // done - RESTARTABLE(::close(this->socket()), rc); + ::close(this->socket()); // were we externally suspended while we were waiting? thread->check_and_wait_while_suspended(); diff -r a837fa3d3f86 -r e95fc50106cf src/os/bsd/vm/os_bsd.inline.hpp --- a/src/os/bsd/vm/os_bsd.inline.hpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/bsd/vm/os_bsd.inline.hpp Fri Jun 14 07:46:22 2013 -0700 @@ -178,11 +178,11 @@ } inline int os::close(int fd) { - RESTARTABLE_RETURN_INT(::close(fd)); + return ::close(fd); } inline int os::socket_close(int fd) { - RESTARTABLE_RETURN_INT(::close(fd)); + return ::close(fd); } inline int os::socket(int domain, int type, int protocol) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/bsd/vm/perfMemory_bsd.cpp --- a/src/os/bsd/vm/perfMemory_bsd.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/bsd/vm/perfMemory_bsd.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -120,7 +120,7 @@ addr += result; } - RESTARTABLE(::close(fd), result); + result = ::close(fd); if (PrintMiscellaneous && Verbose) { if (result == OS_ERR) { warning("Could not close %s: %s\n", destfile, strerror(errno)); @@ -632,7 +632,7 @@ if (PrintMiscellaneous && Verbose) { warning("could not set shared memory file size: %s\n", strerror(errno)); } - RESTARTABLE(::close(fd), result); + ::close(fd); return -1; } @@ -656,7 +656,7 @@ if (result != -1) { return fd; } else { - RESTARTABLE(::close(fd), result); + ::close(fd); return -1; } } @@ -734,9 +734,7 @@ mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - // attempt to close the file - restart it if it was interrupted, - // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) { @@ -909,7 +907,7 @@ // attempt to close the file - restart if it gets interrupted, // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/linux/vm/attachListener_linux.cpp --- a/src/os/linux/vm/attachListener_linux.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/linux/vm/attachListener_linux.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -199,7 +199,7 @@ ::unlink(initial_path); int res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr)); if (res == -1) { - RESTARTABLE(::close(listener), res); + ::close(listener); return -1; } @@ -212,7 +212,7 @@ } } if (res == -1) { - RESTARTABLE(::close(listener), res); + ::close(listener); ::unlink(initial_path); return -1; } @@ -340,24 +340,21 @@ struct ucred cred_info; socklen_t optlen = sizeof(cred_info); if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (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.uid != euid || cred_info.gid != egid) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } // peer credential look okay so we read the request LinuxAttachOperation* op = read_request(s); if (op == NULL) { - int res; - RESTARTABLE(::close(s), res); + ::close(s); continue; } else { return op; @@ -408,7 +405,7 @@ } // done - RESTARTABLE(::close(this->socket()), rc); + ::close(this->socket()); // were we externally suspended while we were waiting? thread->check_and_wait_while_suspended(); diff -r a837fa3d3f86 -r e95fc50106cf src/os/linux/vm/perfMemory_linux.cpp --- a/src/os/linux/vm/perfMemory_linux.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/linux/vm/perfMemory_linux.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -120,7 +120,7 @@ addr += result; } - RESTARTABLE(::close(fd), result); + result = ::close(fd); if (PrintMiscellaneous && Verbose) { if (result == OS_ERR) { warning("Could not close %s: %s\n", destfile, strerror(errno)); @@ -632,7 +632,7 @@ if (PrintMiscellaneous && Verbose) { warning("could not set shared memory file size: %s\n", strerror(errno)); } - RESTARTABLE(::close(fd), result); + ::close(fd); return -1; } @@ -656,7 +656,7 @@ if (result != -1) { return fd; } else { - RESTARTABLE(::close(fd), result); + ::close(fd); return -1; } } @@ -734,9 +734,7 @@ mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - // attempt to close the file - restart it if it was interrupted, - // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) { @@ -907,9 +905,7 @@ mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); - // attempt to close the file - restart if it gets interrupted, - // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/solaris/dtrace/jvm_dtrace.c --- a/src/os/solaris/dtrace/jvm_dtrace.c Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/solaris/dtrace/jvm_dtrace.c Fri Jun 14 07:46:22 2013 -0700 @@ -122,9 +122,7 @@ } static int file_close(int fd) { - int ret; - RESTARTABLE(close(fd), ret); - return ret; + return close(fd); } static int file_read(int fd, char* buf, int len) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/solaris/vm/attachListener_solaris.cpp --- a/src/os/solaris/vm/attachListener_solaris.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/solaris/vm/attachListener_solaris.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -392,7 +392,7 @@ return -1; } assert(fd >= 0, "bad file descriptor"); - RESTARTABLE(::close(fd), res); + ::close(fd); // attach the door descriptor to the file if ((res = ::fattach(dd, initial_path)) == -1) { @@ -410,7 +410,7 @@ // rename file so that clients can attach if (dd >= 0) { if (::rename(initial_path, door_path) == -1) { - RESTARTABLE(::close(dd), res); + ::close(dd); ::fdetach(initial_path); dd = -1; } @@ -549,7 +549,7 @@ } // close socket and we're done - RESTARTABLE(::close(this->socket()), rc); + ::close(this->socket()); // were we externally suspended while we were waiting? thread->check_and_wait_while_suspended(); diff -r a837fa3d3f86 -r e95fc50106cf src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -6679,11 +6679,11 @@ } int os::close(int fd) { - RESTARTABLE_RETURN_INT(::close(fd)); + return ::close(fd); } int os::socket_close(int fd) { - RESTARTABLE_RETURN_INT(::close(fd)); + return ::close(fd); } int os::recv(int fd, char* buf, size_t nBytes, uint flags) { diff -r a837fa3d3f86 -r e95fc50106cf src/os/solaris/vm/perfMemory_solaris.cpp --- a/src/os/solaris/vm/perfMemory_solaris.cpp Thu Jun 13 11:16:38 2013 -0700 +++ b/src/os/solaris/vm/perfMemory_solaris.cpp Fri Jun 14 07:46:22 2013 -0700 @@ -122,7 +122,7 @@ addr += result; } - RESTARTABLE(::close(fd), result); + result = ::close(fd); if (PrintMiscellaneous && Verbose) { if (result == OS_ERR) { warning("Could not close %s: %s\n", destfile, strerror(errno)); @@ -437,7 +437,7 @@ addr+=result; } - RESTARTABLE(::close(fd), result); + ::close(fd); // get the user name for the effective user id of the process char* user_name = get_user_name(psinfo.pr_euid); @@ -669,7 +669,7 @@ if (PrintMiscellaneous && Verbose) { warning("could not set shared memory file size: %s\n", strerror(errno)); } - RESTARTABLE(::close(fd), result); + ::close(fd); return -1; } @@ -749,9 +749,7 @@ mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); - // attempt to close the file - restart it if it was interrupted, - // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) { @@ -922,9 +920,7 @@ mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); - // attempt to close the file - restart if it gets interrupted, - // but ignore other failures - RESTARTABLE(::close(fd), result); + result = ::close(fd); assert(result != OS_ERR, "could not close file"); if (mapAddress == MAP_FAILED) {