Mercurial > hg > graal-jvmci-8
comparison src/os/linux/vm/perfMemory_linux.cpp @ 10978:e95fc50106cf
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
author | rdurbin |
---|---|
date | Fri, 14 Jun 2013 07:46:22 -0700 |
parents | a837fa3d3f86 |
children | 1f4355cee9a2 |
comparison
equal
deleted
inserted
replaced
10969:a837fa3d3f86 | 10978:e95fc50106cf |
---|---|
118 | 118 |
119 remaining -= (size_t)result; | 119 remaining -= (size_t)result; |
120 addr += result; | 120 addr += result; |
121 } | 121 } |
122 | 122 |
123 RESTARTABLE(::close(fd), result); | 123 result = ::close(fd); |
124 if (PrintMiscellaneous && Verbose) { | 124 if (PrintMiscellaneous && Verbose) { |
125 if (result == OS_ERR) { | 125 if (result == OS_ERR) { |
126 warning("Could not close %s: %s\n", destfile, strerror(errno)); | 126 warning("Could not close %s: %s\n", destfile, strerror(errno)); |
127 } | 127 } |
128 } | 128 } |
630 RESTARTABLE(::ftruncate(fd, (off_t)size), result); | 630 RESTARTABLE(::ftruncate(fd, (off_t)size), result); |
631 if (result == OS_ERR) { | 631 if (result == OS_ERR) { |
632 if (PrintMiscellaneous && Verbose) { | 632 if (PrintMiscellaneous && Verbose) { |
633 warning("could not set shared memory file size: %s\n", strerror(errno)); | 633 warning("could not set shared memory file size: %s\n", strerror(errno)); |
634 } | 634 } |
635 RESTARTABLE(::close(fd), result); | 635 ::close(fd); |
636 return -1; | 636 return -1; |
637 } | 637 } |
638 | 638 |
639 // Verify that we have enough disk space for this file. | 639 // Verify that we have enough disk space for this file. |
640 // We'll get random SIGBUS crashes on memory accesses if | 640 // We'll get random SIGBUS crashes on memory accesses if |
654 } | 654 } |
655 | 655 |
656 if (result != -1) { | 656 if (result != -1) { |
657 return fd; | 657 return fd; |
658 } else { | 658 } else { |
659 RESTARTABLE(::close(fd), result); | 659 ::close(fd); |
660 return -1; | 660 return -1; |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 // open the shared memory file for the given user and vmid. returns | 664 // open the shared memory file for the given user and vmid. returns |
732 return NULL; | 732 return NULL; |
733 } | 733 } |
734 | 734 |
735 mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); | 735 mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); |
736 | 736 |
737 // attempt to close the file - restart it if it was interrupted, | 737 result = ::close(fd); |
738 // but ignore other failures | |
739 RESTARTABLE(::close(fd), result); | |
740 assert(result != OS_ERR, "could not close file"); | 738 assert(result != OS_ERR, "could not close file"); |
741 | 739 |
742 if (mapAddress == MAP_FAILED) { | 740 if (mapAddress == MAP_FAILED) { |
743 if (PrintMiscellaneous && Verbose) { | 741 if (PrintMiscellaneous && Verbose) { |
744 warning("mmap failed - %s\n", strerror(errno)); | 742 warning("mmap failed - %s\n", strerror(errno)); |
905 | 903 |
906 assert(size > 0, "unexpected size <= 0"); | 904 assert(size > 0, "unexpected size <= 0"); |
907 | 905 |
908 mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); | 906 mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); |
909 | 907 |
910 // attempt to close the file - restart if it gets interrupted, | 908 result = ::close(fd); |
911 // but ignore other failures | |
912 RESTARTABLE(::close(fd), result); | |
913 assert(result != OS_ERR, "could not close file"); | 909 assert(result != OS_ERR, "could not close file"); |
914 | 910 |
915 if (mapAddress == MAP_FAILED) { | 911 if (mapAddress == MAP_FAILED) { |
916 if (PrintMiscellaneous && Verbose) { | 912 if (PrintMiscellaneous && Verbose) { |
917 warning("mmap failed: %s\n", strerror(errno)); | 913 warning("mmap failed: %s\n", strerror(errno)); |